Reposted due to no answers being posted on my last post.
This is a problematic script. I asked this question ~1 month ago, added WaitForChild to the second line, and that was that, everything was working fine again. However, the script broke again. It just doesn't work this time.
When the script is working, it brings up a GUI if someone's "Job" value is Job's default value. If the Job value is the name of the facility followed by the city it is in, it'll pay you for the delivery, add the miles you drove to the leaderstat, and reset everything. If your "Job" value is its default, it will create a random number between 1 and 3 and depending on that number it will update the GUI's text buttons and such with the properties of the job corresponding to that number.
There are no output errors or anything, it just doesn't work anymore. Does anyone know why? This script is a local script.
math.randomseed(tick)
local Part = game.Workspace:WaitForChild("AugustaTidbitGreenSquare")
local Gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("AugustaTidbitScreenGui").Frame
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if game.Players.LocalPlayer.Job.Value == "a" then
Gui.Visible = true
local number = math.random(3)
if number == 1 then
Gui.TextButton.Text = "SellGoods - Belfast ME"
Gui.TextLabelMoney.Text = "553"
Gui.TextLabel.Text = "46"
Gui.City.Value = "Belfast ME"
elseif number == 2 then
Gui.TextButton.Text = "SellGoods - Augusta ME"
Gui.TextLabelMoney.Text = "56"
Gui.TextLabel.Text = "1"
Gui.City.Value = "Augusta ME"
elseif number == 3 then
Gui.TextButton.Text = "Wallbert - Augusta ME"
Gui.TextLabelMoney.Text = "47"
Gui.TextLabel.Text = "2"
Gui.City.Value = "Augusta ME"
elseif game.Players.LocalPlayer.Job.Value == "Tidbit - Augusta ME" then
game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value + game.Players.LocalPlayer.ToBePaid.Value
game.Players.LocalPlayer.ToBePaid.Value = 0
game.Players.LocalPlayer.leaderstats.MilesDriven.Value = game.Players.LocalPlayer.leaderstats.MilesDriven.Value + game.Players.LocalPlayer.MilesToBeDriven.Value
game.Players.LocalPlayer.MilesToBeDriven.Value = 0
game.Players.LocalPlayer.Job.Value = "a"
game.Players.LocalPlayer.JobDestination.Value = "b"
end
end
end
end)

9 comments
Maybe roblox has updated some features? Or you might still be trying to code in Experimental mode...
FE is enabled.
And, in this game, it always has been.
math.random(3) won't work. Tell me what you are trying to achieve with that line of code
Maybe it has a virus?
if you're not using dark mode already do that and it fixes your problem
math.random(3) gets a random number between 0 and 3, right? I saw the line math.random(100) on the roblox wiki's page about math.random in one of their demo script things. How can Roblox Studio get a virus unless your entire computer has a virus, which mine doesn't?
The dark theme didn't do anything.
math.randomseed(tick) is the issue. Did it get deprecated when nobody was looking or something? I know because I put it right before math.random and the GUI popped right up but the text on the textlabels/textbuttons was "label" or "button." Anyone know why?