I tried:
game.Workspace.PlayerNameHere.maxhealth=100
but i don't think thats the correct line. i already made a thread about this but none of the lines that were given to me worked ):
does it need a function?
I tried:
game.Workspace.PlayerNameHere.maxhealth=100
but i don't think thats the correct line. i already made a thread about this but none of the lines that were given to me worked ):
does it need a function?
You are referencing the player modal, to change the max health of a player, you need to reference the humanoid, like this: game.Workspace.PlayerNameHere.Humanoid.MaxHealth = 100
To give a player a certain amount of health when they join:
game.Players:PlayerAdded:Connect(function(player)
player.Character:WaitForChild("Humanoid").MaxHealth = Number
end)
This is not working either, do I have to put into ServerScriptService?
Basically, I'm trying to health ONE CERTAIN player in a server when he/she joins a server. The automated health is 100 but I'd like to change that to 150 max health. I don't know why this is hard for me to do ):
Make sure its in a normal script not a local one
I have updated my answer to include a basic function in witch it can be accomplished.
try this
script:
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
if p.Name == "YOURNAME" then
c.Humanoid.MaxHealth = 150
end
end)
end)
That is very over complicated.
Not really, its quite basic to me.
Wait something like CharacterAdded exists... you learn something new everyday.
Lol.
I'm done with this idiot.
This discussion is preserved as it was. New answers, comments, and votes are closed.
8 comments
Just as @AlphaGamer150 said you need to access the Humanoid of the player, also Lua is case sensitive..
Also... how do I health??? WHAT. Learn English.
Maybe the studios script service is broken..? Still not working D:
How do you know its not working?
Is there an error?
An error would tell us what your doing wrong.
@ScriptingHelper1038 Here, go gain some braincells... https://www.robloxdev.com/learn-roblox/coding-scripts
Can someone please close this question? She probably took the answer and doesn't want to accept our answers D: