local Part = script.Parent
Part.Touched:Wait(5) -- how do I see who touched it?
Print("WhouTouched")
As shown in example 1 it is how I wanted it, BUT, how do I see who touched it? Any way to connect a function to the wait? or see who touched As shown in the example below
Example~2:
local Part = script.Parent
Part.Touched:Connect(function(WhoTouched)
Print(WhouTouched)
end)
local Part = script.Parent
local Players = game:GetService("Players")
local touchedPart = Part.Touched:Wait()
local player = Players:GetPlayerFromCharacter(touchedPart.Parent)
print(player)
It’s most likely because an accessory touched the part, or another part touched it first. You can try using FindFirstAncestorOfClass
local Part = script.Parent
local Players = game:GetService("Players")
local touchedPart = Part.Touched:Wait()
local model = touchedPart:FindFirstAncestorOfClass("Model")
if model then
local player = Players:GetPlayerFromCharacter(model)
print(player)
end