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

Custom Character glitching out?

Asked by
WH_HAN 2
3 years ago
Edited 3 years ago

Hello!

I’ve recently made a custom character script.

What do I want to achieve? I would like to make it so that when a certain Roblox player joins the game, they will spawn as a custom character differently from every other player. eg. When I join the game I will spawn as a custom character differently to everyone else's custom character

What are the current issues?

  1. Whenever the player rejoins the game, they don't spawn as a custom character anymore

  2. When I fix the first problem, the starter character glitches out. It spawns and deletes multiple of the same startercharacter inside my player, which is confusing because I don't think my script is a closed loop...

Here is my current script:

local value = 0

game.Players.PlayerAdded:connect(function(plr)
    value = 0
end)

game.Players.PlayerAdded:connect(function(plr) 
    plr.CharacterAdded:connect(function(char) 
        wait(1) --wait a second
        if plr.Name == "WH_HAN" and value == 0 then 
            local model = game.ReplicatedStorage.King.StarterCharacter
            local model1 = model:Clone()
            model1.Parent = game.Workspace
            model1.PrimaryPart.CFrame = plr.Character.PrimaryPart.CFrame 
            plr.Character = model1
            model1.Humanoid.HipHeight = 3.8
            value = 1
        end
    end)
end)

If anyone could please help me out, or point me in the right direction that would be greatly appreciated! (Also if I wasn't clear on what I wanted to achieve, let me know and I can explain a bit more)

1 answer

Log in to vote
0
Answered by
WH_HAN 2
3 years ago

Nvm I got it working.

Ad

Answer this question