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

How come I'm unable to change a Players health?

Asked by 3 years ago
Edited 3 years ago

I currently have a vest system and it should be setting the health when a player has a vest but for some reason, it just won't work at all it works perfectly fine without doing that but while doing it it won't work at all what is going on?

01game.Players.PlayerAdded:Connect(function(Player)
02    Player.CharacterAppearanceLoaded:Connect(function(Character)
03        local Humanoid = Character:WaitForChild("Humanoid")
04 
05        ---PlayerHealth
06        local MaxHealth = Humanoid.MaxHealth
07        local Health = Humanoid.Health
08 
09        ---Vests
10        local Vests = {
11 
12            ["TanVest"] = Character:FindFirstChild("TanVest");
13            ["BlackVest"] = Character:FindFirstChild("BlackVest");
14        }
15 
View all 34 lines...
0
did you look in the output? no errors? Persona3_FES 2 — 3y
0
None vincentthecat1 199 — 3y
0
maybe it doesnt trigger it for some reason? ive had the exact same problem some times, but ive noticed it only happened with LocalScripts. are you using a LocalScript? if so, you could probably benefit from using RemoteEvent:OnServerInvoke for that player. Persona3_FES 2 — 3y
0
I'm using a normal script vincentthecat1 199 — 3y
View all comments (2 more)
0
well, then, maybe you could use the reverse?: remoteEvent:OnClientEvent:connect() and in the ServerScript: remoteEvent:FireClient() Persona3_FES 2 — 3y
0
I actually tried that as a solution and it never did set the health and if I tried to do something like that for the if and elseif it wouldn't work like at all no text would be printed stating the vest a player has on vincentthecat1 199 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

you must humanoid.Maxhealth = 150 not maxhealth = humanoid.maxhealth , maxhealth = 150 this is a mistake of beginner scripter if you write maxhealth = 150 it just change the variable but you write humanoid.maxhealth it change value

Ad

Answer this question