[solved] Having trouble changing character model to another model during game

does anyone know the needs for changing character model in game? if i put random model in starter character it gives me that model as starter character but i cannot seem to change into that model when i use … during game.

local function onCharacterAdded(character)
	local player = game.Players:GetPlayerFromCharacter(character)
	
	local clone = game.ReplicatedStorage.Model:Clone()
	clone.Name = character.Name
	
	clone.HumanoidRootPart.Anchored = false
	clone:SetPrimaryPartCFrame(character.PrimaryPart.CFrame)
	
	player.Character = clone
	clone.Parent = workspace
	
	print("MESSAGE/Info:  I have gone through making the new character..")
end

local function onPlayerAdded(player)
	
	player.CharacterAdded:Connect(onCharacterAdded)
	
end

game.Players.PlayerAdded:Connect(onPlayerAdded)

btw i have this inside of a character added.

so you can’t use the character variable that comes from CharacterAdded… you have to get charcter from player variable. not sure why. but also… this code is unfinished and you won’t want to have it like this in a CharacterAdded event…