I want to find the buyer of an item I put in my game but I don't know how. this script should allow the buyer to go faster.
player = script.Parent.Parent.Parent.Parent.Parent coins = player.leaderstats.Coins price = 100 h = h.Character.Humanoid -- Here is where I want to find the buyer function buy() if coins.Value >= price then coins.Value = coins.Value - price h.Walkspeed = 20 else print 'Player does not have enough coins to buy!' end end script.Parent.MouseButton1Down:connect(buy)
player = script.Parent.Parent.Parent.Parent.Parent -- This is the buyer. coins = player.leaderstats.Coins price = 100 h = player.Character.Humanoid -- Here is where I want to find the buyer -- You already found the player using the "player" variable. function buy() if coins.Value >= price then coins.Value = coins.Value - price h.WalkSpeed = 20 -- Walkspeed should be spelled as "WalkSpeed". Fixed this for you. else print 'Player does not have enough coins to buy!' end end script.Parent.MouseButton1Down:connect(buy)
At the top of your script, the "player" variable that you set should be the buyer, right? Also, like I said in your other thread (I mean question), the "Walkspeed" needs to have a capital s. If you are using a LocalScript, you can find the player through...
player = game.Players.LocalPlayer -- Instead of script.Parent.Parent.Parent.Parent.Parent.
well if its a gamepass u can go to trade, transections and sales but sorry i dont know for thing bought for the game currency, but its pretty easy to tell who has walkspeed 20 because its about 5 more speed than usaul