So, i'm working on a zombie survival game and i'm working on scripting the weapon pickups, but when I click the part that the script and ClickDetector is in, it doesn't do anything, even when I set points to over 800. And it worked fine without me trying to set a price in "Points" (the currency of the game)
local Points = game.ServerScriptService.leaderboard.leaderstats.Points --I have a leaderboard script that keeps track of what wave you're on and how many points you have
function hi(x)
if Points >799
then
local y = x.Backpack
local z = game.ReplicatedStorage["AK47"] --Changes the tool that it gives, I have tested without adding the points and it gave me the weapon
if wait()
then
Points = Points - 800
end
z:Clone().Parent = y
end
script.Parent.ClickDetector.MouseClick:connect(hi)

1 comment
okay, sorry. Thank you so much for fixing it, now I see how I went wrong with a lot of the code, i'm still learning and this was really helpful!