User blog:ArchOnua85/Scripting Help request : Health Asset Text Button

Tired of having weak skills on scripting, I decided to make my first hand-made script : A text button which set your max health to 1000. This is important for me because its the missing feature of a loadout gui Im developping for my FPS Project.

I request help because it wont work. The problem is the function, but I attempt to determinate what is wrong. The current script work like this :

player = game.Players.LocalPlayer



function onClicked(textButton)

local Stamina = player.Humanoid:GetState("MaxHealth"):ChangeState("MaxHealth")

Stamina.value = 1000





script.Parent.Parent.Parent.Frame1.Visible = false

script.Parent.Parent.Parent.Frame2.Visible = false

script.Parent.Parent.Parent.Frame3.Visible = false

script.Parent.Parent.Parent.Frame4.Visible = false

end

script.Parent.MouseButton1Down:connect(onClicked)



Please note it is Local script because the initial script ( to give guns ) was operational as Local Script.