Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Code doesn't work with elseif donutcode.Value == 1?

So this script is supposed to parent a part to workspace every 5 seconds, I was doing a test run to make sure the code works but nothing is printed when active is true. Here's my code;

local active = script.Parent.active
local donutfolder = game.ServerStorage.donuts
local donutcode = script.Parent.donutcode
while true do
    if active.Value then 
	elseif donutcode.Value == 1 then --> This is the line of code I know is causing it.
	print("peter 'allah' griffin")
    else
      warn('inactive11!!!!1!')
        end
wait(5)
    end

Check line 6. How can I change line 6 so the print below it works?

1 comment

0

Try getting rid of the else in the elseif I think

1 answer

✓ Accepted answer

I think the problem is that you are checking first if active.Value is true ... which looks like it is true because its skipping the elseif's statements.

To test this out go to the active which is script.Parent and remove its value to make it false or nil, this will make the elseif run.

Unless you want both if statements to run so if active.Value is true check donutcode.Value your code then should look like this

local active = script.Parent.active
local donutfolder = game.ServerStorage.donuts
local donutcode = script.Parent.donutcode

while true do
	if active.Value then
		if donutcode.Value == 1 then
			print("peter 'allah' griffin")
		else
			warn('inactive11!!!!1!')
		end	
	end
wait(5)
end

3 comments

0

This doesn't warn if active is false and donutcode is 0.

0

i know that , u just didn't clarify what you want the script to do.

0

you have to do separate if statements for each condition in that case. nothing complicated

This discussion is preserved as it was. New answers, comments, and votes are closed.