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

how do you mention the player hitting a part ? [closed]

Asked by 3 years ago

I don't have a script. because i wouldn't have asked this question if i knew how to mention it.

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
zane21225 243 Moderation Voter
3 years ago

Here's the code I whipped up:

script.Parent.Touched:Connect(function(touched) --touched is the bodypart that the player touched the part from

if touched.Parent:FindFirstChild('Humanoid') then --if the thing that touched is a character then
    local player = game.Players:GetPlayerFromCharacter(touched.Parent) --get the player from the character
    --do whatever with the player from here
end
Ad