Why doesn't this script work?

Greetings, fellow developers!

  1. What do you want to achieve? Keep it simple and clear!
    So, today I was writing a script that gave the player starting clothes and it removed the players accessories. But it didn’t work and I got some issues.

  2. What is the issue? Include screenshots / videos if possible!
    I got some errors, which I will send a screenshot of:

    image

    image
    That’s It.

1 Like

You have one too many ends. Remove the one at line 20

1 Like

Alright, I removed some ends, now the code looks like this:
`image

1 Like

I think it’s because you have “shirt” not capitalized as a variable and “Shirt” capitalized trying to refer to that variable. You’re also missing and end statement to your for loop.

1 Like

Is there a reason as to why you need to do CharacterAdded:Wait() even though you have an event for it?

1 Like

And why did you create a character variable if you already have the character on the character added event?

1 Like

I just rewrote the entire script, this is what I got:
image

1 Like

If you go to game settings in studio and go to avatar and scroll down, you can override player clothing

1 Like

You should change line 19.

shirt:Clone().Parent and pants:Clone().Parent = char

Your Shirt was capitalized and you need to match the shirt on line 1.
Change the plr in line 7 to player.
Also move line 1 and 2 into line 5. The variable character wasn’t declared so another error will pop up.

1 Like

You need to properly declare your instances. For instance, you have “plr” written but have “player” defined as the variable. Also, add a variable for character or instead move shirt and pants inside your event.

1 Like