This is supposed to upgrade the value MaxHealth which is in the model ds, if you have 5 Gems or more only. What is wrong?
local player = game.Players.LocalPlayer
local health = player.ds.MaxHealth
local gems = player.ds.Gems
function Click()
if gems.Value >= 5 and health.Value >= 120 then
gems.Value = gems.Value - 5
health.Value = health.Value + 20
script.Parent.Parent.Parent.Script.Disabled = false
wait(.2)
script.Parent.Parent.Parent.Script.Disabled = true
elseif gems.Value >= 5 and health.Value == 100 then
gems.Value = gems.Value - 5
health.Value = 120
script.Parent.Parent.Parent.Script.Disabled = false
wait(.2)
script.Parent.Parent.Parent.Script.Disabled = true
end
end
script.Parent.MouseButton1Down:connect(Click)

2 comments
We'll for one You do not need the last line cause that's a click connection and your not clicking anything it might not solve your problem but u need toget rid of it but it might let me know if t helped
Are you trying to make it automatic? or?