I need help on line 5 how do I find the localplayer that touched it based off of line 5?
function onTouched(hit) game.Players:FindFirstChild script.Parent.Transparency = 1 script.Parent.CanCollide = false game.Players:FindFirstChild -- part of script I need help on end script.Parent.Touched:connect(onTouched)
I did add the closing door part (assuming the parent is a door) but that shouldn't be hard for you to do.
local debounce = true local TimeBe4ReUse = 2 function onTouched(part) if not debounce then return end local human = part.Parent:findFirstChild("Humanoid") if human then debounce = false script.Parent.Transparency = 1 script.Parent.CanCollide = false local plr = game.Players:GetPlayerFromCharacter(part.Parent) --plr. do stuff here C: print(plr.Name) end wait(TimeBe4ReUse) debounce = true end script.Parent.Touched:connect(onTouched)