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

Buy script not doing a single thing? (Has console error)

Asked by 7 years ago
Edited 7 years ago

So I have this script,

script.Parent.MouseButton1Click:connect(function()
    if numoflemons.Value == 0 then
        local newstand = standmodel:Clone()
        newstand.Parent = game.Workspace
    elseif numoflemons.Value >= 1 then 
        local newstand = game.Workspace.standmodel      
        numoflemons.Value = numoflemons.Value + 1       
        newstand.screen.SurfaceGui.TextLabel.Text = "Lemonade Stands : "..numoflemons.Value
    end
    money.Value = money.Value - 50
end)

(That's only a part of the script, the rest is not relevant.) So I want it to, when the user clicks, if there isn't already a clone of the model, clone it and then add 1 to a value, then take away $50, if there is already a clone, then add 1 and change a surfacegui textlabel to say how many things they own, then take away 50$. Studio won't work because I have a DataStore that won't let it work, when I test it online, it doesnt work. There is an error, on line 5 : attempt to compare number with userdata. so what's wrong with this? Sorry about that paragraph of boringness (Is that even a word?). But I don't know where I messed up.

Answer this question