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

[SOLVED] Why is my function not being called?

Hello! I made a function here which loads the map but doesn't call the timer function, which is called "restartTimer()". Could anyone tell me why?

I also apologize if this script is messy. It's my most advanced game yet and I've been having a bit of trouble. Also, feel free to link any sources you may use, I'll take a look at them.

Also, no errors come up in the output. If they did, I would have added them here.

Thanks in advance!

-- These are the names of the maps and whether they have been used or not in this current game.

local TremaineTranquility = false -- has it been played yet?
local CliffsideCemetery = false

function roundEnd()
			
				if mapIdentifier == 1 then
					if TremaineTranquility == false then
						require(game.ReplicatedStorage.Load.TremaineTranquility)("TremaineTranquility") --Loads this map, called "Tremaine Tranquility."

						print("Done! Loaded 1 - TremaineTranquility")
					
						TremaineTranquility = true
					else
						
						roundEnd()
						return
						
					end
			
				elseif mapIdentifier == 2 then 
				
					if CliffsideCemetery == false then
						require(game.ReplicatedStorage.Load.CliffsideCemetery)("CliffsideCemetery")

						print("Done! Loaded 2 - CliffsideCemetery")
					
						CliffsideCemetery = true
					else
						
						roundEnd()
						return
						
					end
				
				wait(0.1)
				
				for i,v in pairs (game.Players:GetChildren()) do
					
					v.TeamColor = BrickColor.new("Maroon")
				
					v:LoadCharacter()
				
				end
			
			restartTimer()
		end
end

6 comments

0

I don't think you can run the function itself inside of the function.

0

Where is the funtion? i see when you call it, but i dont see where you declared it and made it an actual function

0

Line 6 is where he declared it. But, he called the function he's trying to call inside of the function he's trying to create.

0

I'll try making a new function and then call that new function, but inside of that new function would be the first function. Would that work?

0

Yeah, that worked. Thanks Killerbrenden for helping me find the source of the issue!

0

No problem! Put [SOLVED] In your title so people know this question has been solved.

1 answer

I ended up solving this by doing this:


--Inside of the roundEnd function.
                    else
	 
	                        roundRecall()
	                        return
	 
	                    end

--Created a new function here.

function roundRecall()

	roundEnd()

end

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