Admin StarterCharacter Script Not Working?

Hi I’m making a game and i got some help making a script that would change he StarterCharacter of a specific person.

code:

local AdminCharacter = game.ServerStorage:WaitForChild("AdminCharacter")

local Players = game:GetService("Players")
local AdminList = {
    "AdminHere",
    "OtherAdminHere",
    "OwnerHere",
}

local function PlayerAdded(Player)
    Player.CharacterAdded:Connect(function(Character)

        if table.find(AdminList, Player.Name) then --This would check if the player that joined is 1 of the Admins inside the table

            local CharacterClone = AdminCharacter:Clone()
            CharacterClone.Parent = workspace
            CharacterClone:MakeJoints()

            Character = CharacterClone
        end 
    end)
end

Players.PlayerAdded:Connect(PlayerAdded)

It did not work.

This is what happened

bruh why does this happen .

Please comment any solutions.

1 Like

That looks like R6, are you sure you’re using the correct ROBLOX Body Type?

R6 & R15 are different

1 Like

Should be Player.Character = CharacterClone, you’re only changing the contents of a variable.

Also as a recommendation, make it work using a UserId system, names can be changed but UserIds cannot

1 Like

There are many Character = Characterclone s

Should i put the Player.Character = CharacterClone in all of them or a specific one?

I’d say all of them if your purpose is to change the character of a player, you probably need to also destroy the old character afterwards since I’m not sure if the old one will stick around

I got this error when i changed them all

Screenshot 2021-07-19 113314

This is what the code looks like.

That’s not what I had asked you to do, I wanted you to just change the Character = CharacterClone line to what I had mentioned revert the code to how it was before and just change that line

Witch one? there are many. Can you please specify?

(Sorry if I’m being annoying. I’m new to Lua)

You only have one of those lines…It’s line 18, the only one that exactly is Character = CharacterClone

It worked! But there is a clone of my original avatar, and the switched StarterCharacter did not load its animations.

Ill try and destroy the old character but it might be tough for me

You can destroy the previous character and parent the player’s animation script to the new character.

local AdminCharacter = game.ServerStorage:WaitForChild("AdminCharacter")

local Players = game:GetService("Players")
local AdminList = {
    "AdminHere",
    "OtherAdminHere",
    "OwnerHere",
}

local function PlayerAdded(Player)
    Player.CharacterAdded:Connect(function(Character)

        if table.find(AdminList, Player.Name) then --This would check if the player that joined is 1 of the Admins inside the table

            local Animate = Character:WaitForChild("Animate")

            local CharacterClone = AdminCharacter:Clone()
            CharacterClone.Parent = workspace
            CharacterClone:MakeJoints()

            Animate.Parent = CharacterClone
            Player.Character = CharacterClone
            Character:Destroy()
        end 
    end)
end

Players.PlayerAdded:Connect(PlayerAdded)

It Deleted the original character but the startercharacter still has no aniamtions. Thanks for trying to help though!

I think it could not have animations because of a conflict of RigTypes. From what I see you were using R15 but the rig is R6. So trying to copy over the Animate from your character wouldn’t work because of different rigs. Perhaps change the StarterCharacter rig to be R15 or change your avatar to be r6?

I already changed the avatar settings to be R6

Then perhaps you may need to put the Animate script in the StarterCharacter . So I’d recommend doing a paly test, going into the explorer and into your character and copying the Animate script, then after stopping the test, put it in your StarterCharacter and see if that does anything?

No it did not do anything. Anything else i could try?