Hi I was making this script and I was wonder why this didn't work. Also it didn't have any output errors and it is in a local script. Can you help me with this script problem?
function OnClick()
local plr = game.Players.LocalPlayer
if plr:FindFirstChild("leaderstats") ~= nil then
local clicks = plr:FindFirstChild("leaderstats"):FindFirstChild("Cow Clicks")
if (clicks ~= nil) then
clicks.Value = clicks.Value + 1
script.Parent.Sound:Play()
end
else
print("leaderstats not found")
end
end
script.Parent.ClickDetector.MouseClick:connect(OnClick)

2 comments
didn't work ;( any ideas?
Did you get rid of the LocalScript and put it in a server script?