Jump to content

Why wont setElementHealth work?


Recommended Posts

Posted

Hi,

I am new to scripting, but why wont the setElementHealth work? Both the hiding cursor and hiding GUI work. (Client)

    function revivePlayer(button) 
     if button == "left" then 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] )) 
    setElementHealth(player, 100) 
    showCursor(false) 
    end 
end 

Thanks!

Posted

When that event is triggered, the GUI disappears and the Cursor no longer shows (as it was supposed to), however, the players health does not change to 100?

Posted

I guess you are trying to set the health of your own player. Change the first argument from player to localPlayer like this.

setElementHealth(localPlayer, 100) 

Posted

I tried that;

    function revivePlayer() 
     if button == "left" then 
    guiSetVisible(GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] )) 
    setElementHealth(localPlayer, 100) 
    showCursor(false) 
    end 
end 
  

Still nothing!

Posted
Can you show me the code where you spawn the player?

I'm using the default "play" gamemode, so isn't player already spawned? Or am I getting confused here?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...