This is the LocalScript inside the frame with the ImageButton to click for stats. It does nothing and displays no errors, HELP???
local buttonstart = script.Parent.ImageButton local leaderstats = game.Players.LocalPlayer.leaderstats local function onButtonActivated() local currentvalue = leaderstats['Snot Power'].Value == leaderstats['Snot Power'].Value + 1 end buttonstart.Activated:Connect(onButtonActivated)
Hello, your problem is that you are trying to change the value on the locally sided instead of server-sided so you are not displaying the points for everyone so that is why you don't get an error because it is technically displaying for the local user but not the server.
You can read more about it here: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
For this to work, you need an extra script that gives the points which is relatively easy to do.
STEPS: add a RemoteEvent in ReplicatedStorage and call it AddPoint
LocalScript:
local buttonstart = script.Parent.ImageButton local RepS = game:GetService("ReplicatedStorage") local DB = false local function onButtonActivated() if DB == false then DB = true RepS.AddPoint:FireServer() -- This will launch an event in the server script in ServerScriptService wait(1) -- Your Cooldown DB = false end end buttonstart.MouseButton1Click:Connect(onButtonActivated)
Normal Script (In ServerScriptService)
local RepS = game:GetService("ReplicatedStorage") local function AddPoints(plr) local CurrentValue = plr.leaderstats.SnotPower CurrentValue.Value = CurrentValue + 1 -- this just sets the SnotPower to the same value and adding 1. end RepS.AddPoint.OnServerEvent:Connect(AddPoints) -- When the local script is used// the Imagebutton is pressed it will run our function in line 3
Hopefully It helped!