I have a remoteevent in replicatedstorage that gives you money everytime you click. I want to make a debug (admin) gui to give the localplayer that is whitelisted money, but when i type the script
script.Parent.MouseButton1Down:Connect(function() game.Players.LocalPlayer:WaitForChild("leaderstats").Money.Value = 100000 end)
it doesnt work and only displays it temporarily. how can i fix this?
You can't access the leaderstats from a LocalScript. That's why it'd be good to use your RemoteEvent
in ReplicatedStorage
. Insert another Script in ServerScriptService. This is what I suggest you have in your scripts:
Local Script
script.Parent.MouseButton1Down:Connect(function() game.ReplicatedStorage.RemoteEvent:FireServer() end)
Server Script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) player:WaitForChild("leaderstats").Money.Value = 100000 end)
Hope this helps!