SmileyE-Watcher

Rig switcher

Dec 29th, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. -- Place this script inside a LocalScript in StarterPlayerScripts or StarterCharacterScripts
  2.  
  3. local Player = game.Players.LocalPlayer
  4. local Mouse = Player:GetMouse()
  5. local Character = Player.Character or Player.CharacterAdded:Wait()
  6. local humanoid = Character:WaitForChild("Humanoid")
  7.  
  8. -- Function to switch to R6 or R15
  9. local function switchRig(rigType)
  10. humanoid:ChangeRigType(rigType)
  11. wait(0.1) -- Wait for rig change to take effect
  12. Player:LoadCharacter() -- Reset character
  13. end
  14.  
  15. -- Create UI
  16. local screenGui = Instance.new("ScreenGui")
  17. screenGui.Parent = Player:WaitForChild("PlayerGui")
  18.  
  19. -- Main UI Frame
  20. local uiFrame = Instance.new("Frame")
  21. uiFrame.Size = UDim2.new(0, 200, 0, 150)
  22. uiFrame.Position = UDim2.new(0.5, -100, 0.5, -75)
  23. uiFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  24. uiFrame.BorderSizePixel = 2
  25. uiFrame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  26. uiFrame.BackgroundTransparency = 0.5
  27. uiFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  28. uiFrame.Parent = screenGui
  29.  
  30. -- Make the UI draggable
  31. local dragging, dragInput, dragStart, startPos
  32.  
  33. local function updateDrag(input)
  34. local delta = input.Position - dragStart
  35. uiFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  36. end
  37.  
  38. uiFrame.InputBegan:Connect(function(input)
  39. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  40. dragging = true
  41. dragStart = input.Position
  42. startPos = uiFrame.Position
  43. input.Changed:Connect(function()
  44. if dragging == false then
  45. input.Changed:Disconnect()
  46. end
  47. end)
  48. end
  49. end)
  50.  
  51. uiFrame.InputChanged:Connect(function(input)
  52. if input.UserInputType == Enum.UserInputType.MouseMovement then
  53. if dragging then
  54. updateDrag(input)
  55. end
  56. end
  57. end)
  58.  
  59. uiFrame.InputEnded:Connect(function(input)
  60. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  61. dragging = false
  62. end
  63. end)
  64.  
  65. -- R6 Button
  66. local r6Button = Instance.new("TextButton")
  67. r6Button.Size = UDim2.new(0, 180, 0, 50)
  68. r6Button.Position = UDim2.new(0.5, -90, 0.5, -25)
  69. r6Button.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  70. r6Button.TextColor3 = Color3.fromRGB(255, 255, 255)
  71. r6Button.Text = "R6"
  72. r6Button.BorderSizePixel = 0
  73. r6Button.Parent = uiFrame
  74. r6Button.MouseButton1Click:Connect(function()
  75. switchRig(Enum.HumanoidRigType.R6)
  76. end)
  77.  
  78. -- R15 Button
  79. local r15Button = Instance.new("TextButton")
  80. r15Button.Size = UDim2.new(0, 180, 0, 50)
  81. r15Button.Position = UDim2.new(0.5, -90, 0.5, 30)
  82. r15Button.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  83. r15Button.TextColor3 = Color3.fromRGB(255, 255, 255)
  84. r15Button.Text = "R15"
  85. r15Button.BorderSizePixel = 0
  86. r15Button.Parent = uiFrame
  87. r15Button.MouseButton1Click:Connect(function()
  88. switchRig(Enum.HumanoidRigType.R15)
  89. end)
  90.  
  91. -- Minimize/Close Button (X)
  92. local closeButton = Instance.new("TextButton")
  93. closeButton.Size = UDim2.new(0, 30, 0, 30)
  94. closeButton.Position = UDim2.new(1, -35, 0, -35)
  95. closeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  96. closeButton.Text = "X"
  97. closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  98. closeButton.BorderSizePixel = 0
  99. closeButton.Parent = uiFrame
  100. closeButton.MouseButton1Click:Connect(function()
  101. uiFrame.Visible = not uiFrame.Visible
  102. end)
  103.  
  104. -- Minimized Icon (when UI is hidden)
  105. local minimizedIcon = Instance.new("TextButton")
  106. minimizedIcon.Size = UDim2.new(0, 50, 0, 50)
  107. minimizedIcon.Position = UDim2.new(0.5, -25, 0.5, -25)
  108. minimizedIcon.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  109. minimizedIcon.Text = "RIG"
  110. minimizedIcon.TextColor3 = Color3.fromRGB(255, 255, 255)
  111. minimizedIcon.BorderSizePixel = 0
  112. minimizedIcon.Visible = false
  113. minimizedIcon.Parent = screenGui
  114. minimizedIcon.MouseButton1Click:Connect(function()
  115. uiFrame.Visible = true
  116. minimizedIcon.Visible = false
  117. end)
  118.  
  119. -- Show minimize icon when UI is hidden
  120. uiFrame.GetPropertyChangedSignal("Visible"):Connect(function()
  121. if not uiFrame.Visible then
  122. minimizedIcon.Visible = true
  123. else
  124. minimizedIcon.Visible = false
  125. end
  126. end)
  127.  
Tags: Script
Advertisement
Add Comment
Please, Sign In to add comment