Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Custom Character glitching out?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.