Script doesnt work when i enable it with a another script

this is pretty simple so ill keep it short
im making a radar game with my friend and when a tornado form i want to make it have a path. so i code everything and i cant figure out why on earth it breaks
please excuse my messy coding im not a good scripter
cloning script: (the ef0 path block renames itself to just Path)

while true do
	wait(5)
	game.ServerStorage.EF0Path:Clone().Parent = game.Workspace
	game.Workspace.EF0Path.CFrame = CFrame.new(script.Parent.Position.X,1.1,script.Parent.Position.Z)
end

while true do
	if script.Parent.windspeed.Value > 65 then
		script.Parent.EF0PATH.Enabled = true
		script.Parent.EF1PATH.Enabled = false
		script.Parent.EF2PATH.Enabled = false
		script.Parent.EF3PATH.Enabled = false
		script.Parent.EF4PATH.Enabled = false
		script.Parent.EF5PATH.Enabled = false
	end
	if script.Parent.windspeed.Value > 86 then
		script.Parent.EF0PATH.Enabled = false
		script.Parent.EF1PATH.Enabled = true
		script.Parent.EF2PATH.Enabled = false
		script.Parent.EF3PATH.Enabled = false
		script.Parent.EF4PATH.Enabled = false
		script.Parent.EF5PATH.Enabled = false
	end
	if script.Parent.windspeed.Value > 111 then
		script.Parent.EF0PATH.Enabled = false
		script.Parent.EF1PATH.Enabled = false
		script.Parent.EF2PATH.Enabled = true
		script.Parent.EF3PATH.Enabled = false
		script.Parent.EF4PATH.Enabled = false
		script.Parent.EF5PATH.Enabled = false
	end
	if script.Parent.windspeed.Value > 136 then
		script.Parent.EF0PATH.Enabled = false
		script.Parent.EF1PATH.Enabled = false
		script.Parent.EF2PATH.Enabled = false
		script.Parent.EF3PATH.Enabled = true
		script.Parent.EF4PATH.Enabled = false
		script.Parent.EF5PATH.Enabled = false
	end
	if script.Parent.windspeed.Value > 166 then
		script.Parent.EF0PATH.Enabled = false
		script.Parent.EF1PATH.Enabled = false
		script.Parent.EF2PATH.Enabled = false
		script.Parent.EF3PATH.Enabled = false
		script.Parent.EF4PATH.Enabled = true
		script.Parent.EF5PATH.Enabled = false
	end
	if script.Parent.windspeed.Value > 200 then
		script.Parent.EF0PATH.Enabled = false
		script.Parent.EF1PATH.Enabled = false
		script.Parent.EF2PATH.Enabled = false
		script.Parent.EF3PATH.Enabled = false
		script.Parent.EF4PATH.Enabled = false
		script.Parent.EF5PATH.Enabled = true
	end
	wait()
end
1 Like

ive also noticed when i disable the enabler script it starts working but breaks when i reenable it. only the EF0 path works and thats all

If you select the scripts in the explorer, are they being enabled?
How does the windspeed change?

windspeed changes with .Value +=1
and yes they are being enabled

You must make a range for each condition cuz it will always run only the first ‘if’ condition , so you know a range with a min and a max wind speed. Something like this:

while true do
    local windSpeed = script.Parent.windspeed.value
    if (windSpeed >= 65 and windSpeed < 86) then -- range of [65,86)
        -- Your instructions
    elseif (windSpeed >= 86 and windSpeed < 111) then
        -- More instructions
    end
    wait()
end

Try again with the idea of ranges in each conditional (I’m using Google Translate)

oh my god i forgot about elseif lol ill try this

One more thing, when you clone the path you must enable the script afterwards

Try to use Disabled instead of Enabled.

i dont think that would work they literally are the same thing

Just try, it helped me once.

i tried and it still didnt work

i created the path manually with the script

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.