local RobLength = 30
local RobCooldown = 60
local Alarm = game.Workspace.ATM.RobPart.ATMAlarm
-----------------------------------------------
local ATM = script.Parent
local Status = ATM.StatusPart.BillboardGui.Text
local Robprompt = ATM.RobPart.ProximityPrompt
Robprompt.HoldDuration = RobLength
Status.Text = "Open"
Status.TextColor3 = Color3.fromRGB(27, 186, 51)
Robprompt.Triggered:Connect(function(plr)
Robprompt.Enabled = false
Status.Text = "Closed"
Status.TextColor3 = Color3.fromRGB(255,99,99)
local RandomMoney = math.random(100,150,200,600,1000)
plr.leaderstats.Cash.Value += RandomMoney
Alarm.Volume = 1
wait()
Alarm:Play()
Alarm.Looped = true
Alarm.RollOffMaxDistance = 450
wait(60)
Alarm.Looped = false
wait(RobCooldown)
Robprompt.Enabled = true
Status.Text = "Open"
Status.TextColor3 = Color3.fromRGB(27, 186, 51)
end)
This only works when I do like 100, instead of random amounts. Why is that? Please help, I want random amounts.
1 Like
Qoucx
(Sunken)
#2
local RobLength = 30
local RobCooldown = 60
local Alarm = game.Workspace.ATM.RobPart.ATMAlarm
-----------------------------------------------
local ATM = script.Parent
local Status = ATM.StatusPart.BillboardGui.Text
local Robprompt = ATM.RobPart.ProximityPrompt
Robprompt.HoldDuration = RobLength
Status.Text = "Open"
Status.TextColor3 = Color3.fromRGB(27, 186, 51)
Robprompt.Triggered:Connect(function(plr)
math.randomseed(os.time()) -- Making math.random actually random
Robprompt.Enabled = false
Status.Text = "Closed"
Status.TextColor3 = Color3.fromRGB(255,99,99)
local RandomMoney = math.random(100,1000) -- Takes in two arguments, minimum and maximum
plr.leaderstats.Cash.Value += RandomMoney
Alarm.Volume = 1
wait()
Alarm:Play()
Alarm.Looped = true
Alarm.RollOffMaxDistance = 450
wait(60)
Alarm.Looped = false
wait(RobCooldown)
Robprompt.Enabled = true
Status.Text = "Open"
Status.TextColor3 = Color3.fromRGB(27, 186, 51)
end)
2 Likes
Thank you so much! This works.
Qoucx
(Sunken)
#4
No problem man, good luck on your game
1 Like
system
(system)
Closed
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.