Guest User

Robbing script

a guest
Jul 6th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2. local robbing = false
  3. local clicks = 25
  4. local clicked = 0
  5.  
  6. uis.InputBegan:Connect(function(key, event)
  7. if key.KeyCode == Enum.KeyCode.E and not event then
  8. if (game.Players.LocalPlayer.Character.PrimaryPart.Position - script.Parent.Parent.Adornee.Position) .magnitude < 6 then
  9. robbing = true
  10. if clicked < clicks then
  11. script.Parent.Parent.Text.Text = "Robbing..."
  12. script.Parent.Visible = true
  13. clicked = clicked + 1
  14. script.Parent.Robber:TweenSize(UDim2.new((clicked/clicks), 0, 1, 0), "Out", "Quad", 0.3, true)
  15. script.Parent.BackgroundColor3 = Color3.fromRGB(0, 255, 115)
  16. script.Parent.Robber.TextLabel.TextColor3 = Color3.fromRGB(0, 170, 73)
  17. if clicked == clicks and game.Workspace.RobPart.Open.Value == true then
  18. wait(0.3)
  19. script.Parent.Parent.Text.Text = "Robbery Success!"
  20. local amount = math.random(500, 5000)
  21. script.Parent.Robber.TextLabel.Text = "+ $"..amount.."!"
  22. robbing = false
  23. game.ReplicatedStorage.RobStatus:FireServer(amount)
  24. elseif clicked == clicks and game.Workspace.RobPart.Open.Value == false then
  25. wait(0.3)
  26. script.Parent.Parent.Text.Text = "Robbery Failed!"
  27. script.Parent.Robber.BackgroundColor3 = Color3.fromRGB(197, 55, 55)
  28. script.Parent.Robber.TextLabel.TextColor3 = Color3.fromRGB(149, 41, 41)
  29. script.Parent.Robber.TextLabel.Text = "We have no money..."
  30. robbing = false
  31. end
  32. end
  33. end
  34. end
  35. end)
  36.  
  37. wait(3)
  38. while true do
  39. if (game.Players.LocalPlayer.Character.PrimaryPart.Position - script.Parent.Parent.Adornee.Position) .magnitude < 6 then
  40. script.Parent.Parent.Enabled = true
  41. else
  42. robbing = false
  43. script.Parent.Visible = true
  44. script.Parent.Parent.Text.Text = "Press E to Rob!"
  45. script.Parent.Robber.TextLabel.Text = ""
  46. clicked = 0
  47. script.Parent.Robber.Size = UDim2.new(0,0,1,0)
  48. script.Parent.Parent.Enabled = false
  49. end
  50. wait(0.3)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment