OK so I made this Character customization GUI and when I scroll through shirts in the studio it works. But in game it doesn't work. The output shows no errors at all. Here's how it works. Basically when a player enters a game they are give a blank shirt, pants and hat. As the player scrolls through the table of shirt id's. The ID is given to the shirt, pants or hat.
-Local Script in GUI-
repeat wait() until game.Players.LocalPlayer.Character local Player = game.Players.LocalPlayer local CharacterCustomizationGUI = game.StarterGui:WaitForChild("CustomizationUI") local ShirtForward = script.Parent.CustomizationTabs.ShirtTab["Shirt Forward"] local ShirtBackward = script.Parent.CustomizationTabs.ShirtTab["Shirt Backward"] local Shirt = Player.Character:WaitForChild("Shirt") local Shirts = {612283113, 541820204, 294747602} local count = 1 function Update() Shirt.ShirtTemplate = "rbxassetid://"..Shirts[count] end ShirtForward.MouseButton1Down:Connect(function() if count >= #Shirts then else count = count + 1 Update() end end) ShirtBackward.MouseButton1Down:Connect(function() if count > 1 then count = count - 1 Update() end end)
-Shirt,Pants,Hat Giver-
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local Shirt = Instance.new("Shirt", character) Shirt.Name = "Shirt" local Pants = Instance.new("Pants", character) Pants.Name = "Pants" local Hat = Instance.new("Accessory", character) Hat.Name = "Hat" end) end)
I tested in both studio's play solo and server simulation, and in the real game. The result was a success in all three situations, though I did not significantly alter your code.
I'm hoping that by presenting my working test example of your code, that you will be able to deduce or see something that you had not seen prior. If not, I'd be happy to delve further into this issue.
NOTE: LoadCharacterAppearance in StarterPlayer is false and FilteringEnabled in Workspace is true
Try removing all shirts, pants, and hats from the player to begin with, if you want LoadCharacterAppearance set to true. Remember to wait for the character to load before the script tries to remove them.
Here's a snapshot of my test GUI in Explorer: https://gyazo.com/ea363d836c92ef3a6e0d028ee3ce752e
Here's three images of it working correctly in-game:
(Up and Down buttons simulate your CustomizationTabs)
https://gyazo.com/ffefdb7ec45369039ac8d50d875e2d20 https://gyazo.com/125d4c1210b7486388371f60fa6faa51 https://gyazo.com/9f4dfcff56d9c7e6484af677ea8d55b4
Here's the LocalScript inside the player's GUI:
I'd also consider setting local count to 0 and not 1. That way the cycle starts at the beginning of the table
repeat wait() until game.Players.LocalPlayer.Character local Player = game.Players.LocalPlayer --local CharacterCustomizationGUI = game.StarterGui:WaitForChild("CustomizationUI") local ShirtForward = script.Parent.Frame.Up -- changed to match test GUI local ShirtBackward = script.Parent.Frame.Down -- changed to match test GUI local Shirt = Player.Character:WaitForChild("Shirt") local Shirts = {612283113, 541820204, 294747602} local count = 0 function Update() Shirt.ShirtTemplate = "rbxassetid://"..Shirts[count] end ShirtForward.MouseButton1Down:Connect(function() if count >= #Shirts then else count = count + 1 Update() end end) ShirtBackward.MouseButton1Down:Connect(function() if count > 1 then count = count - 1 Update() end end)
Here's the server script (unchanged):
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local Shirt = Instance.new("Shirt", character) Shirt.Name = "Shirt" local Pants = Instance.new("Pants", character) Pants.Name = "Pants" local Hat = Instance.new("Accessory", character) Hat.Name = "Hat" end) end)
If this helped you in any way, don't forget to upvote and confirm the answer. Thanks.