I may sound like an idiot but i made a button and when you click its supposed to give you leaderstats but its not.
function onClicked(playerWhoClicked) plr.leaderstats.Clicks.Value = plr.leaderstats.Clicks.Value + 1000 script.Parent.ClickDetector.MouseClick:connect(onClicked)
Add a script into serverscriptservice and put this.
game.Players.PlayerAdded:connect(function(plr) -- when the player joins the game local leaderstats=Instance.new("Configuration") --make folder of leaderstats leaderstats.Name="leaderstats" --define the name leaderstats.Parent=plr -- sets the leaderstats in the player local clicks=Instance.new("NumberValue") --makes the score value clicks.Name="Clicks" -- the name clicks.Parent=leaderstats --sets it so you can see the score on the leaderboard end)
then in the part that you click add this.
function onClicked(playerWhoClicked) local Player=game.Players:GetPlayerFromCharacter(hit.Parent) -- find the player (using the character) Player.leaderstats.Clicks.Value = Player.leaderstats.Clicks.Value + 1 -- adds point end end) script.Parent.ClickDetector.MouseClick:connect(onClicked)
That might work,