So I am making a simulator and trying to make a saving leaderstats! The settings for my game are on but when I sell it will not set my value to others just me so when I go in dev console and print my money it shows I have 300 but I really only have 0!
Theres no errors but it wont give the money to the server side just the client kinda like what hacks do.
local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
local PlayerStats = leaderstats.Parent:WaitForChild("PlayerStats")
game.ReplicatedStorage.Events.SellSugar.OnClientEvent:connect(function(plr) -- Change if event is in different area
if leaderstats.Sugar.Value ~= 0 then
local Cash = leaderstats:WaitForChild("Money")
local Backpack = leaderstats:WaitForChild("Sugar")
local multi = leaderstats.Parent:WaitForChild("PlayerStats").SellBonus
Cash.Value = Cash.Value + multi.Value * Backpack.Value
Backpack.Value = 0
script.Earned:Play()
end
end)
