Idisjsusus

Dont steal

Feb 27th, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local playerName = player.Name
  3. local survivorsFolder = workspace:WaitForChild("Players"):WaitForChild("Survivors")
  4.  
  5. local screenGui = Instance.new("ScreenGui")
  6. screenGui.Parent = cloneref(game:GetService("CoreGui"))
  7.  
  8. local button = Instance.new("TextButton")
  9. button.Parent = screenGui
  10. button.Size = UDim2.new(0, 120, 0, 50)
  11. button.Position = UDim2.new(0.5, -60, 0.5, -25)
  12. button.Text = "Do Generator"
  13. button.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
  14. button.TextColor3 = Color3.new(1, 1, 1)
  15. button.Font = Enum.Font.SourceSansBold
  16. button.TextSize = 14
  17. button.AutoButtonColor = false
  18. button.Draggable = true
  19. button.Active = true
  20.  
  21. -- Adicionando bordas arredondadas
  22. local corner = Instance.new("UICorner")
  23. corner.CornerRadius = UDim.new(0, 8)
  24. corner.Parent = button
  25.  
  26. -- Adicionando sombra
  27. local shadow = Instance.new("UIStroke")
  28. shadow.Color = Color3.fromRGB(0, 0, 0)
  29. shadow.Thickness = 2
  30. shadow.Transparency = 0.5
  31. shadow.Parent = button
  32.  
  33. -- Adicionando efeito de hover
  34. button.MouseEnter:Connect(function()
  35. game:GetService("TweenService"):Create(button, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(70, 220, 70)}):Play()
  36. end)
  37.  
  38. button.MouseLeave:Connect(function()
  39. game:GetService("TweenService"):Create(button, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(50, 200, 50)}):Play()
  40. end)
  41.  
  42. local cooldown = false
  43.  
  44. local function getNearestGenerator()
  45. local playerModel = nil
  46. for _, model in pairs(survivorsFolder:GetChildren()) do
  47. if model:IsA("Model") and model:GetAttribute("Username") == playerName then
  48. playerModel = model
  49. break
  50. end
  51. end
  52.  
  53. if not playerModel then
  54. warn("Player model not found in Survivors folder!")
  55. return
  56. end
  57.  
  58. local rootPart = playerModel:WaitForChild("HumanoidRootPart")
  59. local closestGen = nil
  60. local shortestDist = math.huge
  61.  
  62. local map = workspace:WaitForChild("Map"):WaitForChild("Ingame"):WaitForChild("Map")
  63.  
  64. for _, obj in pairs(map:GetChildren()) do
  65. if obj:IsA("Model") and obj.Name == "Generator" then
  66. local primaryPart = obj.PrimaryPart or obj:FindFirstChild("PrimaryPart")
  67. if primaryPart then
  68. local dist = (primaryPart.Position - rootPart.Position).Magnitude
  69. if dist < shortestDist then
  70. shortestDist = dist
  71. closestGen = obj
  72. end
  73. end
  74. end
  75. end
  76.  
  77. return closestGen
  78. end
  79.  
  80. button.MouseButton1Click:Connect(function()
  81. if cooldown then return end
  82.  
  83. cooldown = true
  84. button.Text = "Cooldown"
  85. button.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
  86.  
  87. local nearestGen = getNearestGenerator()
  88. if nearestGen then
  89. local remotes = nearestGen:WaitForChild("Remotes")
  90.  
  91. -- Executa todas as partes do gerador
  92. for _, remote in pairs(remotes:GetChildren()) do
  93. if remote.Name == "RE" then
  94. remote:FireServer() -- Executa a ação do gerador
  95. elseif remote.Name == "RF" then
  96. remote:InvokeServer("complete") -- Completa o gerador (se necessário)
  97. end
  98. end
  99.  
  100. else
  101. warn("No nearby generator found!")
  102. end
  103.  
  104. task.wait(1)
  105. button.Text = "Do Generator"
  106. button.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
  107. cooldown = false
  108. end)
Advertisement
Add Comment
Please, Sign In to add comment