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

I've updated my last fire script, but how do I refer to parts of the players, such as their health?

I recently asked a question about why my fire script wasn't working, and I got some help. However, I now have an issue where am not sure how to properly refer to parts of the player in the script. I am trying to make a script where when the player approaches the fire, they start burning, but now am not sure how to access their health.

local firePart = script.Parent

local Players = game:GetService("Players");

firePart.Transparency = 1

local function LightOnFire(part)

local fire = part:FindFirstChild("Fire")

if not fire then

fire= Instance.new("Fire")

fire.Parent = part

local client = Players:GetPlayerFromCharacter(part.Parent)

if (client) then

Players.

end

end

end

firePart.Touched:connect(LightOnFire)

1 answer

✓ Accepted answer

if you want to access a player's health it would be client.Character.Humanoid.Health

6 comments

0

ahh ty

0

Could you mark it as the solution? Sorry to bother you

0

now am getting an error message when I try : if (client) then local health =client.Character.Humanoid.Health health - 10 end

0

do you think you can show me how you would create this same script?

0

cause everytime I add a new change, another error pops up

0

Just put client.Character.Humanoid.Health = client.Character.Humanoid.Health - 10

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