Advertisement
Guest User

CharacterCustomization LocalScript

a guest
Apr 10th, 2023
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. local CustamizationFolder = game:GetService("ReplicatedStorage"):WaitForChild("Customaztion")
  2. local CustomGui = script.Parent.Parent
  3. local FinishedButton = CustomGui.Finished
  4. local ShirtSetection = CustomGui.Shirt
  5. local ShirtCurrent = ShirtSetection.Current
  6. local PantsSelection = CustomGui.Pants
  7. local PantsCurrent = PantsSelection.Current
  8.  
  9. if not Character:FindFirstChild("Shirt") then
  10.     local Shirt = Instance.new("Shirt", Character)
  11.     Shirt.Name = "Shirt"
  12. end
  13. if not Character:FindFirstChild("Pants") then
  14.     local Pants = Instance.new("Pants", Character)
  15.     Pants.Name = "Pants"
  16. end
  17. Rig.HumanoidRootPart.CFrame = RigLocation.CFrame * CFrame.new(0,3.5,0)
  18. Rig.HumanoidRootPart.Anchored = true
  19. Rig.Parent = workspace
  20. ------Shirts
  21. local AllShirts = CustamizationFolder:WaitForChild("Shirts"):GetChildren()
  22.  
  23. ShirtCurrent.Value = 1
  24. local ShirtNextButton = ShirtSetection.Next
  25. local ShirtPreviousButton = ShirtSetection.Previous
  26.  
  27. ShirtNextButton.MouseButton1Click:Connect(function()
  28.     ShirtCurrent.Value += 1
  29.    
  30.     if ShirtCurrent.Value > #AllShirts then
  31.         ShirtCurrent.Value = 1
  32.     end
  33.     Rig:WaitForChild("Shirt").ShirtTemplate = AllShirts[ShirtCurrent.Value].ShirtTemplate
  34.     print(ShirtCurrent.Value)
  35. end)
  36.  
  37. ShirtPreviousButton.MouseButton1Click:Connect(function()
  38.     ShirtCurrent.Value -= 1
  39.  
  40.     if ShirtCurrent.Value < 1 then
  41.         ShirtCurrent.Value = #AllShirts
  42.     end
  43.     Rig:WaitForChild("Shirt").ShirtTemplate = AllShirts[ShirtCurrent.Value].ShirtTemplate
  44.     print(ShirtCurrent.Value)
  45. end)
  46. ------Pants
  47. local AllPants  = CustamizationFolder:WaitForChild("Pants"):GetChildren()
  48. Rig:WaitForChild("Pants").PantsTemplate = AllPants[1].PantsTemplate
  49. PantsCurrent.Value = 1
  50. local PantsNextButton = PantsSelection.Next
  51. local PantsPreviousButton = PantsSelection.Previous
  52.  
  53.  
  54. PantsNextButton.MouseButton1Click:Connect(function()
  55.     PantsCurrent.Value += 1
  56.  
  57.     if PantsCurrent.Value > #AllPants then
  58.         PantsCurrent.Value = 1
  59.     end
  60.     Rig:WaitForChild("Pants").PantsTemplate = AllPants[PantsCurrent.Value].PantsTemplate
  61.     print(PantsCurrent.Value)
  62. end)
  63.  
  64. PantsPreviousButton.MouseButton1Click:Connect(function()
  65.     PantsCurrent.Value -= 1
  66.  
  67.     if PantsCurrent.Value < 1 then
  68.         PantsCurrent.Value = #AllPants
  69.     end
  70.     Rig:WaitForChild("Pants").PantsTemplate = AllPants[PantsCurrent.Value].PantsTemplate
  71.     print(PantsCurrent.Value)
  72. end)
  73.  
  74. ----------- Finished
  75. FinishedButton.MouseButton1Click:Connect(function()
  76.     CustomRemote:FireServer(Rig.Shirt.ShirtTemplate, Rig.Pants.PantsTemplate)
  77.     Character.Shirt.ShirtTemplate = Rig.Shirt.ShirtTemplate
  78.     Character.Pants.PantsTemplate = Rig.Pants.PantsTemplate
  79.     CustomGui.Enabled = false
  80.     repeat Camera.CameraType = Enum.CameraType.Custom until
  81.     Camera.CameraType == Enum.CameraType.Custom
  82.     Rig:Destroy()
  83.    
  84. end)
  85.  
  86.  
  87. -------------
  88. repeat Camera.CameraType = Enum.CameraType.Scriptable
  89.     task.wait()
  90. until
  91. Camera.CameraType == Enum.CameraType.Scriptable
  92.  
  93. Camera.CFrame = CamPart.CFrame
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement