Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2024
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. --__GUI__--
  2. local defaultText = "ROLL"
  3. local defaultColor = Color3.new(1,1,1)
  4.  
  5. local rollingText1 = "ROLLING."
  6. local rollingText2 = "ROLLING.."
  7. local rollingText3 = "ROLLING..."
  8.  
  9. local rollButton = script.Parent
  10. local rollText = rollButton.Text
  11.  
  12. --__SFX__--
  13. local badRollSFX = rollButton.SFX.BadRoll
  14. local amazingRollSFX = rollButton.SFX.AmazingRoll
  15. local godlyRollSFX = rollButton.SFX.GodlyRoll
  16. local goodRollSFX = rollButton.SFX.GoodRoll
  17. local okRollSFX = rollButton.SFX.OkRoll
  18. local diceRollSFX = rollButton.SFX.DiceRoll
  19.  
  20.  
  21. --__TRIGGERS__--
  22. local killTrigger = game.ReplicatedStorage.killPlayer
  23. local goodLootTrigger = game.ReplicatedStorage.goodLootGiver
  24. local okLootTrigger = game.ReplicatedStorage.okLootGiver
  25.  
  26. --__OTHER__--
  27. local Player = game:GetService("Players").LocalPlayer
  28.  
  29. local canRoll = true
  30.  
  31. --Rolls a random number when the button is clicked
  32. rollButton.Activated:Connect(function()
  33.  
  34. if canRoll then
  35. canRoll = false
  36.  
  37. badRollSFX.Playing = false
  38. amazingRollSFX.Playing = false
  39. godlyRollSFX.Playing = false
  40. goodRollSFX.Playing = false
  41. okRollSFX.Playing = false
  42. diceRollSFX.Playing = false
  43.  
  44. amazingRollSFX.TimePosition = 0
  45. godlyRollSFX.TimePosition = 0
  46. badRollSFX.TimePosition = 0
  47. goodRollSFX.TimePosition = 0
  48. okRollSFX.TimePosition = 0
  49. diceRollSFX.TimePosition = 0
  50.  
  51.  
  52. rollText.Text = rollingText1
  53. diceRollSFX.Playing = true
  54.  
  55. task.wait(0.5)
  56. rollText.Text = rollingText2
  57.  
  58. task.wait(0.5)
  59. rollText.Text = rollingText3
  60.  
  61. task.wait(0.5)
  62.  
  63.  
  64. --Sets the text to a random number
  65. rollText.Text = tostring((math.random(1,20)))
  66.  
  67.  
  68. --Performs actions based on the random number rolled
  69. --__Godly Roll__--
  70. if tonumber(rollText.Text) == 20 then
  71. rollText.TextColor3 = Color3.new(0.986206, 0.873289, 0)
  72. godlyRollSFX.Playing = true
  73.  
  74.  
  75.  
  76. --__Amazing Roll__--
  77. elseif tonumber(rollText.Text) >= 10
  78. and tonumber(rollText.Text) < 20 then
  79.  
  80. rollText.TextColor3 = Color3.new(0, 1, 0)
  81. amazingRollSFX.Playing = true
  82.  
  83.  
  84.  
  85. --__Good Roll__--
  86. elseif tonumber(rollText.Text) > 5
  87. and tonumber(rollText.Text) < 10 then
  88.  
  89. rollText.TextColor3 = Color3.new(0, 0.967376, 0.714763)
  90. goodRollSFX.Playing = true
  91.  
  92. goodLootTrigger:FireServer()
  93.  
  94.  
  95.  
  96. --__Ok Roll__--
  97. elseif tonumber(rollText.Text) <= 5
  98. and tonumber(rollText.Text) >= 3 then
  99.  
  100. rollText.TextColor3 = Color3.new(0.988434, 0.363272, 0)
  101. okRollSFX.Playing = true
  102.  
  103. okLootTrigger:FireServer()
  104.  
  105.  
  106.  
  107. --__Bad Roll__--
  108. else
  109.  
  110. rollText.TextColor3 = Color3.new(1, 0, 0)
  111. badRollSFX.Playing = true
  112.  
  113. killTrigger:FireServer()
  114.  
  115.  
  116. end
  117.  
  118. task.wait(2)
  119.  
  120. --Sets the text back to default and allows the script to be ran again
  121. canRoll = true
  122. rollText.TextColor3 = defaultColor
  123. rollText.Text = defaultText
  124.  
  125.  
  126. end
  127. end)
  128.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement