How to change leaderstats value on other players?

I’m making a sort of simulator/tycoon where you smack a dummy and it gives you points. The more points you have the better gloves you buy which give you more points to buy better gloves etc etc.

But I am having an issue when I try to script a system where no matter what account you are on you can still get points by smacking the dummy.

I’ve tried using “GetPlayerFromCharacter” and “GetPlayers” but nothing I try seems to work, so for testing purposes I’ve resorted to using my name in the Players list.

Here is an example of the code for a button that buys a better glove (notice my username rather than what I want which is for it to work no matter the account):

script.Parent.ProximityPrompt.Triggered:Connect(function(x2Money)
	game.Players.LarvusIV.leaderstats.smackDollars.Value = game.Players.LarvusIV.leaderstats.smackDollars.Value - 100

	game.Players.LarvusIV.Backpack.Shmack:Destroy()

	game.Workspace.Shmack2.Parent = game.Players.LarvusIV.Backpack

	script.Parent.ProximityPrompt:Destroy()
end)
1 Like

x2Money is currently your player value, so you could use that name or just simply change it to be called “player”