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

I made a script which edits person's health but it only works in studio what should i do?

Here is the script it makes max health equal to level * 100

local Player = game.Players.LocalPlayer --get the local player

local LVL = Player.LevelingSystem.Lvl --get the level

 

LVL.Changed:Connect(function() --when it is changed, update the health

    Player.Character.Humanoid.MaxHealth = LVL.Value * 100

    Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth --optional

end)

1 answer

local Player = game.Players.LocalPlayer --get the local player

local LVL = Player:WaitForChild("LevelingSystem"):WaitForChild("Lvl") --common reason as to why some LocalScripts don't work in studio, things haven't loaded in
LVL:GetPropertyChangedSignal("Value"):Connect(function()
    Player.Character.Humanoid.MaxHealth = LVL.Value * 100
    Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth 
end)

the GetPropertyChangedSignal() method is not really necessary in this case, but it "generates" an event for when the specified property is changed

2 comments

0

Thanks mate, but it still works only in roblox studio

0

where is the script and what type of script is it?

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