Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --__GUI__--
- local defaultText = "ROLL"
- local defaultColor = Color3.new(1,1,1)
- local rollingText1 = "ROLLING."
- local rollingText2 = "ROLLING.."
- local rollingText3 = "ROLLING..."
- local rollButton = script.Parent
- local rollText = rollButton.Text
- --__SFX__--
- local badRollSFX = rollButton.SFX.BadRoll
- local amazingRollSFX = rollButton.SFX.AmazingRoll
- local godlyRollSFX = rollButton.SFX.GodlyRoll
- local goodRollSFX = rollButton.SFX.GoodRoll
- local okRollSFX = rollButton.SFX.OkRoll
- local diceRollSFX = rollButton.SFX.DiceRoll
- --__TRIGGERS__--
- local killTrigger = game.ReplicatedStorage.killPlayer
- local goodLootTrigger = game.ReplicatedStorage.goodLootGiver
- local okLootTrigger = game.ReplicatedStorage.okLootGiver
- --__OTHER__--
- local Player = game:GetService("Players").LocalPlayer
- local canRoll = true
- --Rolls a random number when the button is clicked
- rollButton.Activated:Connect(function()
- if canRoll then
- canRoll = false
- badRollSFX.Playing = false
- amazingRollSFX.Playing = false
- godlyRollSFX.Playing = false
- goodRollSFX.Playing = false
- okRollSFX.Playing = false
- diceRollSFX.Playing = false
- amazingRollSFX.TimePosition = 0
- godlyRollSFX.TimePosition = 0
- badRollSFX.TimePosition = 0
- goodRollSFX.TimePosition = 0
- okRollSFX.TimePosition = 0
- diceRollSFX.TimePosition = 0
- rollText.Text = rollingText1
- diceRollSFX.Playing = true
- task.wait(0.5)
- rollText.Text = rollingText2
- task.wait(0.5)
- rollText.Text = rollingText3
- task.wait(0.5)
- --Sets the text to a random number
- rollText.Text = tostring((math.random(1,20)))
- --Performs actions based on the random number rolled
- --__Godly Roll__--
- if tonumber(rollText.Text) == 20 then
- rollText.TextColor3 = Color3.new(0.986206, 0.873289, 0)
- godlyRollSFX.Playing = true
- --__Amazing Roll__--
- elseif tonumber(rollText.Text) >= 10
- and tonumber(rollText.Text) < 20 then
- rollText.TextColor3 = Color3.new(0, 1, 0)
- amazingRollSFX.Playing = true
- --__Good Roll__--
- elseif tonumber(rollText.Text) > 5
- and tonumber(rollText.Text) < 10 then
- rollText.TextColor3 = Color3.new(0, 0.967376, 0.714763)
- goodRollSFX.Playing = true
- goodLootTrigger:FireServer()
- --__Ok Roll__--
- elseif tonumber(rollText.Text) <= 5
- and tonumber(rollText.Text) >= 3 then
- rollText.TextColor3 = Color3.new(0.988434, 0.363272, 0)
- okRollSFX.Playing = true
- okLootTrigger:FireServer()
- --__Bad Roll__--
- else
- rollText.TextColor3 = Color3.new(1, 0, 0)
- badRollSFX.Playing = true
- killTrigger:FireServer()
- end
- task.wait(2)
- --Sets the text back to default and allows the script to be ran again
- canRoll = true
- rollText.TextColor3 = defaultColor
- rollText.Text = defaultText
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement