Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

CharacterAdded script now working for some reason. Help?

Asked by 6 years ago

I have this portion of my script:

player.CharacterAdded:connect(function(character)
print("I like bananas")
    character:WaitForChild("UpdateHealth"):FireClient(player)
end)

It's in a LocalScript It won't work for some reason. And It won't even fire the print line. What's wrong with it?

1 answer

Log in to vote
0
Answered by
Griffi0n 315 Moderation Voter
6 years ago
Edited 6 years ago

It probably won't help but why are you using a RemoteEvent instead of a BindableEvent? Change the UpdateHealth RemoteEvent to a BindableEvent and then change the recieving end of the event to:

script.Parent:WaitForChild("UpdateHealth").Event:connect(function()
    -- Run your code here
end)

And change the firing script to:

player.CharacterAdded:connect(function(character)
print("I like bananas")
    character:WaitForChild("UpdateHealth"):Fire()
end)
0
Also, use Connect not connect 1TheNoobestNoob 717 — 6y
0
Thanks! wilsonsilva007 373 — 6y
Ad

Answer this question