I'm trying to make a machine that shoots fire when enabled and stops when disabled, but I want it to have fuel so when it runs out it shuts off. But when I tried to test it kept saying: " Expected ')' (to close at column 26) got ')' " I tried multiple things, but nothing worked.
if script.Parent.Size == (0.63, 0, 1.69) then workspace.Roaster.KillBrick.Fire:Stop() workspace.Roaster.KillBrick.Facer.Disabled = true workspace.Roaster.KillBrick.Script.Disabled = true workspace.Roaster.KillBrick.FireS.Disabled = true workspace.Roaster.Model.Model.Script.Disabled = true workspace.RLIGHTS.Green.Transparency = .3 workspace.RLIGHTS.Green.Material = Enum.Material.Glass workspace.RLIGHTS.Red.Transparency = .3 workspace.RLIGHTS.Red.Material = Enum.Material.Glass workspace.RLIGHTS.Yellow.Material = Enum.Material.Neon workspace.RLIGHTS.Yellow.Transparency = 0 end if script.Parent.Size >= (0.63, 0, 1.69) then workspace.RLIGHTS.Yellow.Material = Enum.Material.Glass workspace.RLIGHTS.Yellow.Transparency = .3 workspace.RLIGHTS.Red.Transparency = 0 workspace.RLIGHTS.Red.Material = Enum.Material.Neon workspace.Roaster.Model.Model.Script.Disabled = false end
I'm also pretty sure there's a more beautiful way to do this, but this is all I've got. Thanks in advance if you can help!
You cannot compare Vector3s with a list of numbers (even if you put them in parentheses), you have to specifically create a Vector3. ex, your first line should be if script.Parent.Size == Vector3.new(0.63, 0, 1.69) then
Line 17 is a bigger problem because you cannot perform >=
on Vector3s, only on the x/y/z values.
Another concern is that if you change the size of script.Parent
by adding/subtracting a value repeatedly, "==" is likely to return false when you would expect it to return true -- this is because computers don't handle decimal values well (due to how they represent fractional binary). You can test this for yourself with this script in the command bar: n = 0; for i = 1, 10 do n = n + 0.1 end print(n, n == 1, n-1)
-- it will print "1 false -1.1102230246252e-16" -- "n" is actually a value slightly different than 1; Roblox is just rounding it for you in the output.
Thus, I would recommend keeping track of a 'fuel' variable. Change script.Parent.Size
based on the amount of fuel left; decide what to do on lines 1 and 17 based on fuel
. You could do fuel == 0
on the first line if, when decreasing the fuel, you set it to 0 if the fuel becomes negative.