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

why is my player respawning after i change character model?

Asked by 8 years ago

I have a button that when clicked changes the players character model. It works in studio, but when I play it online about 5 seconds after I change into the new body my player respawns like it gets reset or something. I don't understand what's happening or how to fix it. There are no errors in the output. I'll paste the scripts below.

workspace.spawnbox.button.ClickDetector.ClickEvent.OnServerEvent:connect(function(player)

    local character = game.ServerStorage.Models.P:Clone()
    character.Parent = workspace
    character.Name = player.Name
    character:MoveTo(Vector3.new(0,8,0))
        player.Character = character

    game.ReplicatedStorage.Remotes.CharacterAdded:FireClient(player, character)


    local guis = game.ServerStorage.guis    

    for i, v in ipairs (guis:GetChildren()) do
        v:Clone()
        v.Parent = player.PlayerGui
    end

end)

local player = game.Players.LocalPlayer
function onRemote(character)
    character.Animate.Disabled = false
    workspace.CurrentCamera.CameraSubject = character.Head


end

game.ReplicatedStorage.Remotes.CharacterAdded.OnClientEvent:connect(onRemote)

0
you didn't write that script, did you? Tesouro 407 — 8y
0
no, i borrowed it. I changed a couple things. what does that matter? johnnygadget 50 — 8y

Answer this question