Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how can you find the buyer of an item?

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)

1 comment

0

Where is the script located and what type of script is it? (Server script, local script)

2 answers

✓ Accepted answer
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.

2 comments

0

So it was the WalkSpeed thanks! Would it work if I do player.Humanoid.WalkSpeed?

0

Yeah, it should work. Is the script working?

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

3 comments

0

Umm, I don't think you know what you or they are talking about. They're talking about an item in their game, not on the ROBLOX website.

0

I can manage if its a gamepass but it's not.

0

ik hats what i said, im not sure how to check if someone had bought the item from the game but its not that hard to tell if the person has extra speed or not

This discussion is preserved as it was. New answers, comments, and votes are closed.