Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I tried this script and it didn't work.. I don't know whats wrong i tried and i tried help?

It won't work and I don't know the problem

local Up = script.Parent:WaitForChild("Up")
local Down = script.Parent:WaitForChild("Down")

local Value = 0
local List = {"https://web.roblox.com/catalog/2183288170/CAMO-BAPE?rbxp=24243319" , "https://web.roblox.com/catalog/2640663373/Cheap-Black-Lightning-Adidas?rbxp=24243319" , "https://web.roblox.com/catalog/2501542581/White-Off-White-w-overalls?rbxp=24243319" , "https://web.roblox.com/catalog/2745574498/Nike-Black-Lightning-Hoodie?rbxp=24243319" , "https://web.roblox.com/catalog/345333849/Clockwork-T-Shirt?rbxp=24243319"}

Up.MouseButton1Click:Connect(function()
	local Shirt = script.Character:WaitForChild("Shirt")
	Value = Value + 1
	
	if Value == 1 then
		Shirt.ShirtTemplate = List[1]
		
	elseif Value == 2 then
		Shirt.ShirtTemplate = List[2]
		
	elseif Value == 3 then
		Shirt.ShirtTemplate = List[3]
		
	elseif Value == 4 then
		Shirt.ShirtTemplate = List[4]
		
	elseif Value == 5 then
		Shirt.ShirtTemplate = List[5]
		
	elseif Value > 5 then
		Value = 1
		Shirt.ShirtTemplate = List[1]
	end
	end)
	
	Down.MouseButton1Click:Connect(function()
		local Shirt = script.Character:WaitForChild("Shirt")
		Value = Value - 1
		
		if Value == 1 then
			Shirt.ShirtTemplate = List(1)
			
		elseif Value == 2 then
			Shirt.ShirtTemplate = List(2)
			
		elseif Value == 3 then
			Shirt.ShirtTemplate = List(3)
			
		elseif Value == 4 then
			Shirt.ShirtTemplate = List(4)
		
		elseif Value == 5 then
			Shirt.ShirtTemplate = List(5)
		
		elseif Value < 1 then
			Value = 5
			Shirt.ShirtTemplate = List [5]
		 
		end
	end)

10 comments

0

Please describe the issue you're facing and be sure to include any output errors/warnings in your thread.

0

"local Shirt = script.Character:WaitForChild("Shirt")" seems rather odd. Where's this script located?

0

It says there are no errors/warnings. This is a custom customization shirt script. I don't know what I did wrong but i'll check output ok i found it, it says "Character Is not a valid member of local script so now im confused

0

local Shirt = game.Players.LocalPlayer.Character:WaitForChild("Shirt")

0

Try that line instead

0

Also List(4) should be List[4]. Same thing goes with the other ones

0

ok it worked but my shirts didn't come up because i have lots of errors in output... can u analyze the script for me test it out to see if it works http://prntscr.com/m9cele

0

okay never mind its the shirts thats the problem now idk what i just searched up shirts and chose a random one it says " Image "https://web.roblox.com/catalog/2501542581/White-Off-White-w-overalls?rbxp=24243319" failed to load in "Workspace.earIyroses.Humanoid.Clothes": Request failed"

0

if you would, index the table instead of using 12 if statements

0

i fixed it yesterday thanks

1 answer

✓ Accepted answer
  1. You need to use brackets for keys, not (). If you use (), you're calling a table, and I don't see a __call metamethod in there. If you're looking for something in a table, it should be similar to List[1], List[2], List[3], and so on.

  2. A script doesn't have a character, as it is not a player object, nor is it an NPC (non player character). Use game.Players.LocalPlayer.Character.

  3. Try using 'rbxassetid://id' for pants & shirt ids. In your case, 'rbxassetid://2183288170'.

  4. Please, don't use 50 thousand if statements. Instead, just index the table, and use one if statement to reset the "value" variable to 1.

This discussion is preserved as it was. New answers, comments, and votes are closed.