local owner = script.Parent.Owner local physics = game:GetService("PhysicsService") --The service that lets you create collision groups. physics:CreateCollisionGroup("Door") --Create the door collision group. physics:SetPartCollisionGroup(script.Parent,"Door") physics:CreateCollisionGroup("OwnerParts") --Create the collision group with the owner character parts so they dont colllide with the door. physics:CollisionGroupSetCollidable("Door","OwnerParts",false) --Make owner parts and door uncollidable. script.Parent.Touched:Connect(function(part) --Track when something touches the door. local char = part.Parent local human = char:FindFirstChildOfClass("Humanoid") local plr = game.Players:GetPlayerFromCharacter(char) if plr and human then if owner.Value == nil then --Check if theres no owner. owner.Value = plr for i,v in pairs(char:GetDescendants())do if v:IsA("BasePart") or v:IsA("Part") then physics:SetPartCollisionGroup(v,"OwnerParts") --Set the bodypart's group to OwnerParts so it doesnt collide with the door! end end else --If there is, then kill the intruder if its not the owner. if char ~= owner.Value.Character then human:TakeDamage(10000) end end end end) repeat wait() until owner.Value owner.Value.CharacterAdded:Connect(function(char) --Repeat it when the character respawns! char.ChildAdded:Connect(function(part) if part:IsA("Part") or part:IsA("MeshPart") or part:IsA("BasePart") then physics:SetPartCollisionGroup(part,"OwnerParts") print("RESPAWN") end physics:SetPartCollisionGroup(char:WaitForChild("Head"),"OwnerParts") physics:SetPartCollisionGroup(char:WaitForChild("HumanoidRootPart"),"OwnerParts") print("RESPAWN") end) end)
The issue is I want to know how line "repeat wait() until owner.Value)" works because I'm trying it out by resetting my character and making it print RESPAWN BUT ITS NOT WORKING I NEED HELP