So i have been scripting a shop and when someone buys something the points go down for a sec and then they go back as the points the user had. This is my script
From starter gui:
local player=script.Parent.Parent
local leaderboard=player:WaitForChild("leaderstats")
local points=leaderboard:WaitForChild("Points")
while wait(3)do
points.Value=points.Value+1
end
From Workspace:
game.Players.ChildAdded:connect(function(player)
local stats = Instance.new("Model",player)
stats.Name="leaderstats"
local money = Instance.new("IntValue",stats)
money.Name="Points"
money.Value=0
end)
Also there is the script from an item from the shop
script.Parent.MouseButton1Click:connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("Gravity Coil")
local price = 50
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
if stats.Points.Value >= price then
stats.Points.Value = stats.Points.Value - price
local cloned = item:Clone()
local cloned2 = item:Clone()
cloned2.Parent = player.Backpack
cloned.Parent = player.StarterGear
end
end)

2 comments
Did you check to see if that if statement is being ran? That’s a good strategy to see what’s wrong. Put a print statement in there and check it out.
But yeah this is because you are trying to change values in a local script. Just send it to the server and with a FireServer event and make set the values in the server script