Cakey3101

How To Make A Sonic Speed Simulator Game | EP 8 | Rebirth Handler Client

May 1st, 2025
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | Source Code | 0 0
  1. local Players = game:GetService("Players")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3.  
  4. local Player = Players.LocalPlayer
  5. local PlayerGui = Player.PlayerGui
  6.  
  7. local Remotes = ReplicatedStorage.Remotes
  8. local FormatNumber = require(ReplicatedStorage.Libs.FormatNumber.Simple)
  9.  
  10. local OpenButtonGui = PlayerGui:WaitForChild("Main")
  11. local OpenButton = OpenButtonGui.Right.Rebirth
  12.  
  13. local Gui = PlayerGui:WaitForChild("Rebirth")
  14. local Frame = Gui.Frame
  15.  
  16. local Exit = Frame.Exit
  17. local RebirthButton = Frame.Rebirth
  18.  
  19. local RequiredLevelLabel = Frame.RequiredLevel
  20.  
  21. local RebirthValue = Player:WaitForChild("leaderstats"):WaitForChild("Rebirth")
  22.  
  23. local RequiredLevel = (RebirthValue.Value * 25) + 25
  24. RequiredLevelLabel.Text = `Required Level: {RequiredLevel}`
  25.  
  26. local function RebirthValueChanged()
  27.     RequiredLevel = (RebirthValue.Value * 25) + 25
  28.     RequiredLevelLabel.Text = `Required Level: {RequiredLevel}`
  29. end
  30.  
  31. local function OnRebirthButtonClick()
  32.     Remotes.Rebirth:FireServer()
  33.     RebirthButton.Visible = false
  34. end
  35.  
  36. local function OpenGui()
  37.     Gui.Enabled = true
  38.     Frame:TweenPosition(UDim2.fromScale(0.5, 0.5), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 1)
  39. end
  40.  
  41. local function CloseGui()
  42.     Frame:TweenPosition(UDim2.fromScale(0.5, -2.5), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 1)
  43.     task.wait(1)
  44.     Gui.Enabled = false
  45. end
  46.  
  47. OpenButton.MouseButton1Click:Connect(function()
  48.     if Gui.Enabled == true then
  49.         CloseGui()
  50.     else
  51.         OpenGui()
  52.     end
  53. end)
  54.  
  55. RebirthValue.Changed:Connect(RebirthValueChanged)
  56. RebirthButton.MouseButton1Click:Connect(OnRebirthButtonClick)
  57. Exit.MouseButton1Click:Connect(CloseGui)
  58. Remotes.CanRebirth.OnClientEvent:Connect(function()
  59.     RebirthButton.Visible = true
  60. end)
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment