StarterCharacter Help

I’m trying to create a textbutton in which where you click it, you become a custom character. Essentially what I mean is, I want the player to become a new model once they click the button, and it also kills them to refresh their character. I’ve experimented for an hour with no success, and I’m confused. When I put the StarterCharacter in the StarterPlayer folder at the beginning of the game, it works fine and spawns them as that character, but I want them to spawn as their normal character until they click the button. Here’s my code. (It’s a localscript inside the textbutton)

local getCharacter = game.Players.LocalPlayer.Character
local getPlayer = game.Players.LocalPlayer
local switch = game.ReplicatedStorage:WaitForChild("StarterCharacter"):Clone()

script.Parent.MouseButton1Click:Connect(function()
	switch.Parent = game.StarterPlayer
	getCharacter.Humanoid.Health=0
end)

First of all, you can’t just create a model from the client, it will not happen on the server. I recommend you to use “HumanoididDescription” you can find more about it here:

I also recommend you to watch some tutorials about “Client” and “Server”.

The StarterPlayer is what is used when the game starts.
Instead, you can do something like this:

script.Parent.MouseButton1Click:Connect(function()
    getCharacter:Destroy()	
    switch.Parent = getPlayer
end)

If you destroy the character the player should die by itself.

Got it thanks for the help, I still am a little stuck on client vs server so ill look into that

Just do this

local description = yourCharacter:GetHumanoidDiscription()
player.Character:ApplyHumanoidDiscription(discription) --might need character.humanoid for it.