#How do I use the player leaving as a function starter?
10 messages · Page 1 of 1 (latest)
plz
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
print("Started")
local folder = Instance.new("Folder")
local name = plr.Name.."'s folder"
folder.Parent = workspace
folder.Name = name
local joe = game.ReplicatedStorage.Joe:Clone()
local rootPart = char:WaitForChild("HumanoidRootPart")
local joeRootPart = joe.HumanoidRootPart
joe.Parent = folder
print("Created")
joeRootPart.CFrame = rootPart.CFrame
print("Teleported")
rootPart.RopeConstraint.Attachment1 = joeRootPart.Attachment
print("Attached")
wait(.5)
print("Done")
plr.Character.Humanoid.Died:Connect(function()
joe:Destroy()
folder:Destroy()
end)
end)
end)
in a server script
** You are now Level 6! **
game.Players.PlayerRemoving