✓ Accepted answer
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()
wait(1)
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
end
RepS.AddPoint.OnServerEvent:Connect(AddPoints)
Hopefully It helped!
2 comments
Something I wanted to add is that I see you are using .Activated that is not an instance you should be using you should be using .Mousebutton1Down for GUI's and for ClickDetectors you should use .MouseClick Read more about it here: https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Click
Very Cool! Is there a way to make a cooldown so I cant just spam it?