Hello, I’ve made a simple handler for killing the player if they touch a kill part, however I would like to make it teleport them to the spawn instead. Any help or suggestions are appreciated.
function DescendantAdded(D)
if not D:IsA("BasePart") then return end
if D.Name == "Darkness" then
D.Touched:Connect(function(Hit)
if not Hit.Parent:FindFirstChild("Humanoid") then return end
Hit.Parent.Humanoid.MaxHealth = 0
Hit.Parent.Humanoid.Health = 0
end)
end
end
game.Workspace.DescendantAdded:Connect(DescendantAdded)
for _, v in pairs(game.Workspace:GetDescendants()) do
DescendantAdded(v)
end