Im trying to make it to where, It inserts Players name into the 'local owner' who touch the part 'Invisi' But it isnt working no Idea why...
Here is the script.
function onClicked (playerWhoClicked)
local owner = { }
for _,v in pairs(game.Workspace.floor:GetChildren()) do
v["Claim Dorm"].Invisi.Touched:connect(function(hit)
for _,l in pairs(game.Players:GetChildren())do
if hit.Parent then
local humanoid = l.Character:findFirstChild("Humanoid")
if humanoid then
script.Parent.Parent.Name = l.Name.."'s Dorm"
table.insert(l.Name, #owner)
end
end
end
script.Parent.CanCollide = false
script.Parent.Parent["Smooth Block Model"].CanCollide = false
wait(5)
script.Parent.CanCollide = true
script.Parent.Parent["Smooth Block Model"].CanCollide = true
end)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

2 comments
You have a "hit.Parent" condition when hit is never defined. You have a Click function while you're checking for someone who touched the door. Fix the hit.Parent. I'm not sure what a ClickDetector click function returns, but use whatever that is to check the player's name.
No, the 'hit.Parent' is inside a Touched event.