Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
OnaKat 444 Moderation Voter
6 years ago
Edited 6 years ago

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.

0
Do you get any errors in the developer console? denizprodutions 0 — 6y
0
Try using remote events and the message can be because of deprecated codes Leamir 3138 — 6y
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. saSlol2436 716 — 6y
0
By the way, :moveTo() is deprecated, use :MoveTo() saSlol2436 716 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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

0
That not problem. The problem is no countdown OnaKat 444 — 6y
Ad

Answer this question