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

(SOLVED) How to get the player who clicked a part?

Alright, I'm making a click to sit script, and I wanna know who clicked the part so I can teleport them to the seat. Here's the code I have, it doesn't seem to work though. Code removed because I'm most likely selling it. I looked it up, and this was apparently how it worked, but it was from 2015 and it doesn't work for me, so yeah.

2 comments

0

Player.HumainoidRootPart That's a typo. Also I think it references the player object, not the character

0

please note putting solved is unneeded if you already checked an answer, if you don't have one to check and you fixed your self you can post your own and then rename it to solved, chances are a moderator will mark the question as answered but mark no answers.

3 answers

✓ Accepted answer

Player.HumainoidRootPart has a typo, and it references the player not the character

1 comment

0

Thanks!

Player.HumainoidRootPart is a typo. it should be Player.HumanoidRootPart

local ClickDetector = script.Parent
local Seat = script.Parent.Parent.Parent

function onMouseClick(Player)
    Seat.Disabled = false
    Player.Humanoid:MoveTo(Seat.Position)
end
ClickDetector.MouseClick:connect(onMouseClick)

1 comment

0

Well code has been added back now

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