local plr = script.Parent.Parent.Parent.Parent.Parent.Parent function click() plr.leaderstats.Clicks.Value = plr.leaderstats.Clicks.Value + 1 end script.Parent.MouseButton1Click:connect(click)
It's in a GUI and I've already tried script and local script and it still would do nothing.
Put everything in a local script and use a RemoteEvent inside of ReplicatedStorage, also you can get the player by just doing
local plr = game:GetService("Players").LocalPlayer local rs = game:GetService("ReplicatedStorage") function click() rs.ClickEvent:FireServer() -- Create a RemoteEvent in ReplicatedStorage and call it ClickEvent end script.Parent.MouseButton1Click:connect(click)
And on a server script inside of ServerScriptService would be
local rs = game:GetService("ReplicatedStorage") rs.ClickEvent.OnServerEvent:connect(function(player) -- Remote events always return the player player.leaderstats.Clicks.Value = player.leaderstats.Clicks.Value + 1 end)
If you have any questions or if this does not work please let me know.
Im assuming your game is FE. If it is then in studio you can imagine playing the game and Server and Client are all together. Instead I reccomend doing Server testing which can be done from the same menu as test but it will say server, it will create new windows and you will be able to properly test your game out. You should also use Remote Events if that is a GUI. https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events