Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my Gate w/ Health not take damage, or work?

Here is the model of the gate :

http://www.roblox.com/help-pls-item?id=243199939

If you are in studio with it, put the GateGUI in startergui.

Basically, I'm having two issues with it. One, it refuses to take damage from a linked sword, and two, it doesn't edit the GUI to say what I want it to say.

I've tried moving the Humanoid, and edit the function so it'll work, however I can't get it going. What am I doing wrong here? :(

The script is within the model as well.

2 answers

✓ Accepted answer

You never call SetupGui, so add script.Parent.Humanoid.HealthChanged:connect(SetupGUI) to the, end of your script.

This will call your function when the humanoid's health changes, in other words it runs the function when a specific action occurs, in this case when the Humanoid's health changes.

Also you have to find the player who is damaging the gate so you can edit their gui. Right now you are editing the StarterGui which only changes the gui when the player respawns. To do this use a Touched event to call(run) a function that finds the player's Player in Players (that's a mouthful) and edits their gui, which is in PlayerGui. If you don't know how to do this just tell me :)

Finally do this to your if statements: if diet <= --The Value you already have and diet>= --The next value you are checking for then This gives a range of values to check so no change is skipped over.

As for gate not taking damage TakeDamage() which is used in the LinkedSword isn't working for some odd reason.

3 comments

0

Thank you good sir, i give you cookie if i ever meet you. :D

0

I just edited it.

0

Please accept my answer if you felt it was what you were looking for :)

post the script

2 comments

1

There is a 'comment' feature -- don't post answers that aren't actual answers. This isn't a forum.

0

I do what I want

This discussion is preserved as it was. New answers, comments, and votes are closed.