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

Hit function Help?

Asked by
iLegitus 130
10 years ago

So the hit function has this :

script.Parent.Touched:connect(function(hit)
end)

If the hit.Parent touches it,Then the part acesses its CHARACTER,How do i make it access the Player?

1 answer

Log in to vote
1
Answered by
Muoshuu 580 Moderation Voter
10 years ago
script.Parent.Touched:connect(function(Part)
    local Char=Part.Parent
    if Char then
        local Player=game.Players:GetPlayerFromCharacter(Char)
        if Player then
            --Code goes here
        end
    end
end)
0
Thanks! iLegitus 130 — 10y
Ad

Answer this question