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

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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

0
ahh ty dragonspade21 15 — 5y
0
Could you mark it as the solution? Sorry to bother you IceAndNull 142 — 5y
0
now am getting an error message when I try : if (client) then local health =client.Character.Humanoid.Health health - 10 end dragonspade21 15 — 5y
0
do you think you can show me how you would create this same script? dragonspade21 15 — 5y
View all comments (2 more)
0
cause everytime I add a new change, another error pops up dragonspade21 15 — 5y
0
Just put client.Character.Humanoid.Health = client.Character.Humanoid.Health - 10 IceAndNull 142 — 5y
Ad

Answer this question