Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I say if the person that touched it = F1 or F2?

Asked by 10 years ago

F1 and F2 are variables with player names in them, I have Function OnTouch(hit) how would I put on the next line if (player that hit it) = F1 or F2?

1 answer

Log in to vote
2
Answered by
bbissell 346 Moderation Voter
10 years ago

You can get the Player Name from Players. This could also act as a system to make sure only players touch it and other bricks

function OnTouch(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
player = game.Players:FindFirstChild(hit.Parent.Name)

After this you could use this code to check your variables.

if player.Name == F1 or player.Name == F2 then
Ad

Answer this question