local a = math.random(1,5)
if a == 5 then
script.Parent.start_failure.Disabled = false
print(a)
script.Parent.starting.Disabled = true
end
local a = math.random(1,5)
if a == 5 then
script.Parent.start_failure.Disabled = false
print(a)
script.Parent.starting.Disabled = true
end
Could you please elaborate and provide us more information about what you’re currently trying to achieve?
This script seems fine, what’s not working about it? Any errors?
I want if a == 5, then the Start_failure script starts working. And if a == is another number, then the starting script continues
Remember, when a script’s “Disabled” property is assigned a value of “true” the script is disabled and when a script’s “Disabled” property is assigned a value of “false” the script is not disabled (it is enabled).
if math.random(1, 5) == 5 then
script.Parent.start_failure.Disabled = false
else
script.Parent.starting.Disabled = false
end
local a = math.random(1, 5)
print(a)
local condition = (a == 5) --either true or false
script.Parent.start_failure.Disabled = condition
script.Parent.starting.Disabled = not condition
PS: If it looks confusing you can translate it as following:
if a == 5 then
script.Parent.start_failure.Disabled = true
script.Parent.starting.Disabled = false
else
script.Parent.start_failure.Disabled = false
script.Parent.starting.Disabled = true
end
there are two scripts running at once
You need to disable both of the scripts before launching the game.
I have both disabled
local a = math.random(4, 5)
if a == 5 then
print(a)
script.Parent.start_failure.Disabled = false
script.Parent.starting.Disabled = true
else
script.Parent.start_failure.Disabled = true
script.Parent.starting.Disabled = false
end
If you want a 50% chance use math.random(1, 2) or math.random(2) instead.
local a = math.random(2)
if a == 2 then
script.Parent.start_failure.Disabled = false
script.Parent.starting.Disabled = true
else
script.Parent.start_failure.Disabled = true
script.Parent.starting.Disabled = false
end
Anyway, the provided scripts work so I’m guessing you have the references incorrect or you’re attempting to enable/disable a server script from a local script (which isn’t possible).