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.
01 | player = script.Parent.Parent.Parent.Parent.Parent |
02 | coins = player.leaderstats.Coins |
03 | price = 100 |
04 | h = h.Character.Humanoid -- Here is where I want to find the buyer |
05 |
06 | function buy() |
07 | if coins.Value > = price then |
08 | coins.Value = coins.Value - price |
09 | h.Walkspeed = 20 |
10 | else |
11 | print 'Player does not have enough coins to buy!' |
12 |
13 | end |
14 | end |
15 |
16 | script.Parent.MouseButton 1 Down:connect(buy) |
01 | player = script.Parent.Parent.Parent.Parent.Parent -- This is the buyer. |
02 | coins = player.leaderstats.Coins |
03 | price = 100 |
04 | h = player.Character.Humanoid -- Here is where I want to find the buyer -- You already found the player using the "player" variable. |
05 |
06 | function buy() |
07 | if coins.Value > = price then |
08 | coins.Value = coins.Value - price |
09 | h.WalkSpeed = 20 -- Walkspeed should be spelled as "WalkSpeed". Fixed this for you. |
10 | else |
11 | print 'Player does not have enough coins to buy!' |
12 | end |
13 | end |
14 |
15 | script.Parent.MouseButton 1 Down: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...
1 | 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