I'm trying to make that if only 1 player is touching a part it does something to him. Someone scripted this for me but I don't know how to get the player whos touching it. Just tell me how to get the player.
local part = workspace.Part
local intersectingParts = part:GetTouchingParts()
local playerToCharacterMap = {}
for _, part in pairs(intersectingParts) do
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player and not playerToCharacterMap[player] then
playerToCharacterMap[player] = part.Parent
end
end
Thanks, MajinBluee

4 comments
hmm yes i wrote it for you, it'd be nice if you could accept my previous answer.
But I dont know how to get the player
You already got the player in the code. It's the variable called player after it makes it past the if statement
Oh, I didn't see that LOL