Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make players spawn with a custom player model mid-game?

Asked by 3 years ago

I'm trying to make players spawn as a custom player model during a match in my game but I can't solve the current problem that occurs with my script; whenever someone respawns as a custom player model, it sets off the function again continously. Are there any fixes to my function or other ways to achieve my goal?

My script:

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local oldCharacter = player.Character
        local newCharacter = game.WorkSpace.PreloadedAssets.NewCharacter:Clone()

        newCharacter.HumanoidRootPart.Anchored = false
        newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)

        player.Character = newCharacter
        newCharacter.Parent = game.Workspace
    end)
end)

Answer this question