Lucasluz

Script biel chan

Dec 17th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.97 KB | None | 0 0
  1. -- Create ScreenGui
  2. local screenGui = Instance.new("ScreenGui")
  3. screenGui.Name = "StyleGui"
  4. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  5.  
  6. -- Function to Enable Dragging
  7. local function enableDragging(guiElement)
  8.     local dragging, dragInput, dragStart, startPos
  9.  
  10.     guiElement.InputBegan:Connect(function(input)
  11.         if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  12.             dragging = true
  13.             dragStart = input.Position
  14.             startPos = guiElement.Position
  15.  
  16.             input.Changed:Connect(function()
  17.                 if input.UserInputState == Enum.UserInputState.End then
  18.                     dragging = false
  19.                 end
  20.             end)
  21.         end
  22.     end)
  23.  
  24.     guiElement.InputChanged:Connect(function(input)
  25.         if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  26.             dragInput = input
  27.         end
  28.     end)
  29.  
  30.     game:GetService("UserInputService").InputChanged:Connect(function(input)
  31.         if input == dragInput and dragging then
  32.             local delta = input.Position - dragStart
  33.             guiElement.Position = UDim2.new(
  34.                 startPos.X.Scale,
  35.                 startPos.X.Offset + delta.X,
  36.                 startPos.Y.Scale,
  37.                 startPos.Y.Offset + delta.Y
  38.             )
  39.         end
  40.     end)
  41. end
  42.  
  43. -- Create Main Frame
  44. local frame = Instance.new("Frame")
  45. frame.Size = UDim2.new(0, 300, 0, 400)
  46. frame.Position = UDim2.new(0.5, -150, 0.5, -200)
  47. frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  48. frame.BorderSizePixel = 0
  49. frame.Parent = screenGui
  50.  
  51. -- Add rounded corners to the frame
  52. local frameCorner = Instance.new("UICorner")
  53. frameCorner.CornerRadius = UDim.new(0, 10)
  54. frameCorner.Parent = frame
  55.  
  56. -- Add Drag Bar to the Frame
  57. local dragBar = Instance.new("Frame")
  58. dragBar.Size = UDim2.new(1, 0, 0, 30)
  59. dragBar.Position = UDim2.new(0, 0, 0, 0)
  60. dragBar.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  61. dragBar.BorderSizePixel = 0
  62. dragBar.Parent = frame
  63.  
  64. local dragBarText = Instance.new("TextLabel")
  65. dragBarText.Size = UDim2.new(1, 0, 1, 0)
  66. dragBarText.Text = "Drag Me"
  67. dragBarText.Font = Enum.Font.GothamBold
  68. dragBarText.TextSize = 18
  69. dragBarText.TextColor3 = Color3.fromRGB(255, 255, 255)
  70. dragBarText.BackgroundTransparency = 1
  71. dragBarText.Parent = dragBar
  72.  
  73. -- Enable dragging for the Frame using the Drag Bar
  74. enableDragging(frame)
  75.  
  76. -- Create Buttons for each Style
  77. local styles = {"Sae", "Rin", "Chigiri", "Shidou", "Nagi", "Isagi", "Gagamaru"}
  78. local yOffset = 40
  79.  
  80. local desiredStyle = nil -- Default to nil, meaning no style is selected
  81. local isRolling = false -- Prevent multiple rolls at the same time
  82.  
  83. for _, styleName in ipairs(styles) do
  84.     local styleButton = Instance.new("TextButton")
  85.     styleButton.Size = UDim2.new(0, 280, 0, 40)
  86.     styleButton.Position = UDim2.new(0, 10, 0, yOffset)
  87.     styleButton.Text = styleName
  88.     styleButton.Font = Enum.Font.GothamBold
  89.     styleButton.TextSize = 18
  90.     styleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  91.     styleButton.BackgroundColor3 = Color3.fromRGB(50, 150, 50)
  92.     styleButton.BorderSizePixel = 0
  93.     styleButton.Parent = frame
  94.  
  95.     -- Add rounded corners to the button
  96.     local buttonCorner = Instance.new("UICorner")
  97.     buttonCorner.CornerRadius = UDim.new(0, 10)
  98.     buttonCorner.Parent = styleButton
  99.  
  100.     -- Set the position for the next button
  101.     yOffset = yOffset + 50
  102.  
  103.     -- Button Click Functionality
  104.     styleButton.MouseButton1Click:Connect(function()
  105.         if isRolling then
  106.             print("Already rolling. Please wait.")
  107.             return
  108.         end
  109.  
  110.         desiredStyle = styleName
  111.         print("Attempting to roll for style: " .. desiredStyle)
  112.         isRolling = true
  113.  
  114.         task.spawn(function()
  115.             local player = game:GetService("Players").LocalPlayer
  116.             while isRolling do
  117.                 task.wait(0.5)
  118.                 if player:FindFirstChild("PlayerStats") and player.PlayerStats:FindFirstChild("Style") then
  119.                     local currentStyle = player.PlayerStats.Style.Value
  120.                     if currentStyle ~= desiredStyle then
  121.                         -- Trigger the Spin function
  122.                         game:GetService("ReplicatedStorage").Packages.Knit.Services.StyleService.RE.Spin:FireServer()
  123.                         print("Spin action fired for style: " .. desiredStyle)
  124.                     else
  125.                         print("Style successfully changed to: " .. desiredStyle)
  126.                         isRolling = false -- Stop rolling when the desired style is achieved
  127.                     end
  128.                 end
  129.             end
  130.         end)
  131.     end)
  132. end
  133.  
  134. -- Create the Hide/Show Button
  135. local toggleButton = Instance.new("TextButton")
  136. toggleButton.Size = UDim2.new(0, 100, 0, 40)
  137. toggleButton.Position = UDim2.new(0, 10, 0, 250) -- Positioned on the left side of the screen
  138. toggleButton.Text = "Hide"
  139. toggleButton.Font = Enum.Font.GothamBold
  140. toggleButton.TextSize = 18
  141. toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  142. toggleButton.BackgroundColor3 = Color3.fromRGB(150, 50, 50)
  143. toggleButton.BorderSizePixel = 0
  144. toggleButton.Parent = screenGui -- Attach the button to the ScreenGui, not the Frame
  145.  
  146. -- Add rounded corners to the button
  147. local toggleButtonCorner = Instance.new("UICorner")
  148. toggleButtonCorner.CornerRadius = UDim.new(0, 10)
  149. toggleButtonCorner.Parent = toggleButton
  150.  
  151. -- Toggle Button Functionality: Hide/Unhide the UI
  152. local isVisible = true
  153. toggleButton.MouseButton1Click:Connect(function()
  154.     isVisible = not isVisible
  155.     frame.Visible = isVisible -- Only toggle the frame visibility, not the entire screenGui
  156.     toggleButton.Text = isVisible and "Hide" or "Open" -- Change button text to "Hide" when visible, "Open" when hidden
  157.     toggleButton.BackgroundColor3 = isVisible and Color3.fromRGB(150, 50, 50) or Color3.fromRGB(50, 150, 50) -- Adjust button color
  158. end)
Add Comment
Please, Sign In to add comment