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

So this status isn't changing could anyone help? I'm making a piggy game

So i basically was making a piggy game with Alvinblox's kit. Basically i couldn't fix this bug in my game, basically in a round if all the players die then the piggy wins right? So basically i made those types of situations when the piggy wins or the time goes out or when everyone escapes. So the problem I have is with the piggy wins thing, everything else seems to work. Here is the code, Also forgot to mention that each time these situations happen a status value changes it's a string value. And then it is used on a gui


local function toMS(s)
	return ("i:i"):format(s/60%60, s%60)
end

function module.StartRound(length,piggy,chapterMap)
	local outcome
	for i = length,0,-1 do
		
			if i == (length - 20) then
				module.TeleportPlayers({piggy}, chapterMap.PlayerSpawns:GetChildren(),5)
				
				status.Value = "Executor has woken up!"
				wait(4)
			end
			
			local contestants = {}
			
			local isPiggyHere = false
			
			
			for i, player in pairs(game.Players:GetPlayers()) do
				
				if player:FindFirstChild("Contestant") then
					table.insert(contestants,player)
					elseif player:FindFirstChild("Piggy") then
						isPiggyHere = true
		
									
				end
				
			end

			if not isPiggyHere then
				outcome = "Piggy-Left"
				break
			end
			
			if #contestants == 0 then
				outcome = "Piggy-Won!"
				break
			end
			
			
			if i == 0 then
				outcome = "Game-Over"
				break
			end
			
			status.Value = toMS(i)
			wait(1)
			
			
		end
		
		if outcome == "Piggy-Won" then
			status.Value = "Piggy has won"
		elseif outcome == "Game-Over" then
			status.Value = "Game Over!"
		elseif outcome == "Piggy-Left" then
			status.Value = "Piggy Left"
		end
			
		
		wait(5)
		
	
end

1 comment

0

Hi, a bit sidetrack here, but I see you also using the Alvin's kit, seeing your question. I can see you most possibly able to make the teleportation of the piggy and the players at the start of the game work.

2 answers

This isn't about the question, but if I was you I wouldn't make a game which has already been made.

2 comments

0

This place is to answer questions about scripting don't answer anything off topic please!

0

Don't take the moral high ground when you are copying a game and have a reputation of 0

You did not type in the outcome correctly on line 55. On line 39, you made the outcome equal "Piggy-Won!" But when you typed out your if statement on line 55, you forgot to add an exclamation point. You typed "if outcome == "Piggy-Won". You can compare the differences here if you don't understand me:

-- Line 39
outcome = "Piggy-Won!"

-- Line 55
if outcome == "Piggy-Won"

There is no possible outcome that equals "Piggy-Won", but there is an outcome called "Piggy-Won!" That's why it does not let your status value change.

Hope this helps!

1 comment

0

Thank you soo much!

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