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

My Click detector script is not working And dosent have any errors?

Asked by 1 year ago
Edited 1 year ago

So i tried making it so you can buy more max health in my game With click detectors But.. it dosent work and there isnt even any errors

local part = script.Parent
local detector = part.ClickDetector
detector.MouseClick:Connect(function(player)
    local leaderstats = player.leaderstats
    if leaderstats.Money.Value >= 8 then
        leaderstats.Money.Value -= 8
        leaderstats.MaxHealth += 12
        player.Character.Humanoid.MaxHealth += 12
    end
end)
0
Is this a localscript or serverscript NykoVania 231 — 1y
0
serverscript ImNotAN00b_0kay 31 — 1y
0
i changed it to a local script and there is still no difference ImNotAN00b_0kay 31 — 1y
0
Hmmmm, as a beginner i would take a look to remove the ')' in-front of 'end' inside of the Script! roblox8881215 17 — 1y

3 answers

Log in to vote
0
Answered by 1 year ago
leaderstats.MaxHealth.Value += 12
0
That isn't a valid answer lol Klui36 45 — 1y
Ad
Log in to vote
0
Answered by 1 year ago

I Found the problem and fixed it but i tried making it so it saves after you die But for some reason it dosent work

https://scriptinghelpers.org/questions/132744/local-script-dosent-save-max-health-upgrades

0
Hey why cant i approve my own answer ImNotAN00b_0kay 31 — 1y
Log in to vote
0
Answered by 1 year ago

Have you tried removing the ')' in-front of the 'end' in the Script? You can very easily get wrong.

Alright this is another answer since of 2 nd answered.

If you want to save (132744), make sure you have enabled API and soemthing in game that can be saved. That's my opinion as an early beginner

Answer this question