Remove the end) at the top of you're script you only need those after you use an anonymous function also plr isn't defined so you need to do something like plr = game.Players.LocalPlayer make sure you put the script in a local script. The code should look like this
I would help more but i am not sure how you have everything set up so this is as much as i can do
local cV = Instance.new("IntValue")
cV.Name = "clickedValue"
cV.Parent = plr.PlayerGui
cV.Value = 1
end)
script.Parent.MouseClick:connect(function(plr)
local pCV = plr:FindFirstChild("clickedValue")
local pLS = plr:FindFirstChild("leaderstats")
local pP = pLS:FindFirstChild("Points")
local price = 10
if pP < price then
pCV = pCV + 1
end
end)
local cV = Instance.new("IntValue")
cV.Name = "clickedValue"
plr = game.Players.LocalPlayer
cV.Parent = plr.PlayerGui
cV.Value = 1
script.Parent.MouseClick:connect(function(plr)
local pCV = plr:FindFirstChild("clickedValue")
local pLS = plr:FindFirstChild("leaderstats")
local pP = pLS:FindFirstChild("Points")
local price = 10
if pP < price then
pCV = pCV + 1
end
end)
1 comment
Correct, the player has to be defined for the top area, although in the MouseClick function, plr is a correct parameter.