Why does this not work inside a surfaceGui? Error: Script 'Workspace.SPWN.SurfaceGui.SettingsPage1.ResetLevel.Main', Line 2

local user = game.Players.LocalPlayer
local stats = user:WaitForChild("leaderstats")

wait(5)
money = user.leaderstats.Wins
geldtwee = user.leaderstats.Trofee
price = 10

function buy()
if money.Value >= price then
money.Value = money.Value - price
geldtwee.Value = geldtwee.Value + 1
end
end
script.Parent.MouseButton1Down:connect(buy)

while true do
	wait(2)
if money.Value >= 10 then --Verander dit
	script.Parent.Text = "Trade now"
else
	if money.Value <=10 then --Verander dit
		script.Parent.Text = "Need more Wins!"	
	end
end
end

1 comment

0

That doesn't appear to be the entire error...