✓ Accepted answer
Edit: Referring to your comment, you forgot to put an "end" to close the function and you would also have to check if it's a player
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid)" then
end
end
script.Parent.Touched:Connect(onTouch)
If you mean all players (game.Players) then
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
for i,v in pairs(game.Players:GetPlayers()) do
end
end
end
script.Parent.Touched:Connect(onTouch)
But if you mean all of the character's players then
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
for i,v in pairs(game.Players:GetPlayers()) do
v.Character
end
end
end
script.Parent.Touched:Connect(onTouch)
2 comments
Please provide more information about what you wanted to do after the player touches the part
I want to destroy something but that it only destroys for the player who touched the Part with the Script but not for the other players