I was trying to make a script that would remove money from a player, but the way the game is set up the money is stored in the Server Storage. When I try to do the script it has to have the name of the player so it can function, but I do not know how to get the name of the player.
storage = game.ServerStorage:WaitForChild("PlayerMoney")
price = 250
name = game.Players.LocalPlayer.Name
game.ReplicatedStorage.Remotes.DontHackBoi.OnServerEvent:connect(function()
if storage.name.Value >= price then
storage.name.Value = storage.name.Value - 250
print "Success"
else
print "Failed"
end
end)

2 comments
Is the script in the client or server?
The script is in the server