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

Show messsage when touch Not working :( ?

Asked by 8 years ago

This should show the Message when you touch "Part"

function onHit(hit) -- Made By ME
    local human = hit.Parent:findFirstChild("Humanoid")
    if (human ~= nil) then


human.Health = 100 
local message = Instance.new("Message")
message.Text = "TST"
message.Parent = game.Players:playerFromCharacter(hit.Parent)
wait(3) 
message:Remove ()
    end
end

script.Parent.Touched:connect(onHit)

But its not working :/

1 answer

Log in to vote
0
Answered by 8 years ago
human.Health

This is the line that most likely causes it, if you want to set the health to 100 then you gotta do the following.

human.Parent.Humanoid.Health = 100

or

human.Parent.Humanoid.Health = human.Parent.Humanoid.Health + 100

Also, it's not playerFromCharacter

It's GetPlayerFromCharacter.

Ad

Answer this question