#How do I use the player leaving as a function starter?

10 messages · Page 1 of 1 (latest)

river plover
#

i need to delete a humanoid model but me and my friend arent able to find out how please help

#

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

tulip steppeBOT
#

studio** You are now Level 6! **studio

hallow palm
#

game.Players.PlayerRemoving

river plover
#

server script

#

not local

#

and it goes for a singular plr

#

sooo

#

nvm