So I am scripting buttons and I came over an error to this so everytime I click the button the character respawns and thats it but i want the character to respawn as another character and if theres a starter character I want it destroyed and replaced with another character Heres a video of the problem:
and here is the script
local RS = game:GetService("ReplicatedStorage")
local characterfolder = RS.Characters
local players = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local Clone = characterfolder.GirlGuest
local guest3 = Clone
local removechar = game.StarterPlayer.StarterCharacter
guest3.Name = "StarterCharacter"
if not removechar then
Clone:Clone().Parent = game.StarterPlayer
else
if removechar then
removechar:Destroy()
end
end
end)
Please help me on this