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

Can someone teach me how to put players who touched a part in a table?

Asked by 5 years ago

How do I put players who touched a part in a table?

1 answer

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
5 years ago

This is one way to do it:

local Players = {}

Part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
        table.insert(Players,Player.Name)
    end
end)
Ad

Answer this question