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

I'm making Intermission. It work very well in Studio but not in game. Can you help me?

I'm making intermission. It work fine in Roblox Studio but in game nothing of script work.

local text = script.Parent
local map = game.Workspace.MAP

function GameBegin()
map.Script.Disabled = false
for i = 3, 0, -1 do
	wait(1)
	text.Text = "Intermission: " ..i.. ""
	if i == 0 then
		script.Parent.Parent.Parent.Parent.Character:moveTo(map.Position)
		text.Text = "Game Started!"
		wait(1)
		for m = 3,0,-1 do
			wait(1)
			text.Text = "Time Left: " ..m.. ""
			if m == 0 then
				text.Text = "Time Up!"
				script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
				wait(5)
				GameBegin()
			end
		end
	end
end
end

if game.Players.NumPlayers > 0 then
	GameBegin()
end

This is server script.

Here is link of my game https://www.roblox.com/games/2187266915/KimKeng-Sword-Battle

More: "This game may not function as intended. The developer needs to update the game." What is it??? it's above Play Button.

4 comments

0

Do you get any errors in the developer console?

0

Try using remote events and the message can be because of deprecated codes

0

If your script is a normal Script(or a ServerScript), then, you are doing something wrong. Put all of your code in a LocalScript(or ClientScript) because this is in a GUI.

0

By the way, :moveTo() is deprecated, use :MoveTo()

1 answer

Players 'connect' to the game way before they actually load. This means that the server thinks a player has joined a game before said player is actually playing, and will start the countdown before a player can even see it.

This means that a players character will not even be in the game when the countdown finishes and the script breaks because it can't find the player's character.

A pretty dependable way to wait for players to load is to create a function GetNumberOfPlayers that return the number of players s.t. Player.Character ~= nil and Player.Character:findFirstChild("Humanoid") ~= nil

1 comment

0

That not problem. The problem is no countdown

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