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

Upgrading a value if you have 5 or more gems?

Asked by
RoyMer 301 Moderation Voter
9 years ago

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?

01local player = game.Players.LocalPlayer
02local health = player.ds.MaxHealth
03local gems = player.ds.Gems
04 
05function Click()
06 
07if  gems.Value >= 5 and health.Value >= 120 then
08    gems.Value = gems.Value - 5
09    health.Value = health.Value + 20   
10    script.Parent.Parent.Parent.Script.Disabled = false
11    wait(.2)
12    script.Parent.Parent.Parent.Script.Disabled = true
13 
14elseif  gems.Value >= 5 and health.Value == 100 then
15    gems.Value = gems.Value - 5
View all 23 lines...
0
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 iSvenDerp 233 — 9y
0
Are you trying to make it automatic? or? Shawnyg 4330 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

By looking at your script it seems that you did not define "ds" Unless "ds" is a descendant of LocalPlayer And "MaxHealth" is a descendant of "ds" although MaxHealth is usually a Property of Humanoid or a custom health bar.

If you send me the whole model or whatever you can give me over ROBLOX I can attempt to fix it for you but just from looking at this I cannot help.

All I can say is to define you paths better from my point of view.

Roblox: SurvivalAptissimum

Ad

Answer this question