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

Why is my script not working on the server?

Asked by 8 years ago

This is my script. The script works on solo but not on server. My screengui is in playergui.

local winBoard = game.Workspace.Stationary.LobbyInternal.Jackel.SurfaceGui.TextLabel
local forest = game.ServerStorage.Maps["Forest Map"]
local plains = game.ServerStorage.Maps["The Great Plains"]
local snowy = game.ServerStorage.Maps["Snowy Life"]
local Maps = game.ServerStorage:WaitForChild("Maps"):GetChildren()
local ChosenMap = Maps[math.random(1, #Maps)]
local roundnumber = 0




--[[

Whereever it stops printing is where the problem is

the chat thing from my game is in the startergui    





--]]





function Intermission()
    local IntermissionTime = 20
    wait()
    while IntermissionTime ~= 0 do
        for _,plr in next, game.Players:GetPlayers() do
            local Var = game.Workspace.GuiText
           wait(.5)
            Var.Value = "Intermission: ".. IntermissionTime
            wait(.5)
            IntermissionTime = IntermissionTime - 1
        end
   end

end


function showIntro() 
    local introclone = game.ServerStorage.Intro:Clone()
    introclone.Parent = game.Workspace
end

function stopIntro()
    game.Workspace.Intro:Destroy()
end

function HideTimer()
            local HideTime = 20
            wait(.1)
        while HideTime ~= 0 do

            for _, player in pairs(game.Players:GetChildren()) do
            wait(.1)
         local Var = game.Workspace.GuiText
        wait(.1)

                wait(.5)
                Var.Value = "Time Left To Hide: " .. HideTime
                wait(.3)
                HideTime = HideTime - 1
            end
        end



end

function TeleportAllPlayers()
    local target = Vector3.new(67, 39.5, 9) --could be near a brick or in a new area
for i, v in pairs(game.Players:GetChildren()) do
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0)) --add an offset of 5 for each character
end
end

function TeleportTo()
    local targeto = Vector3.new(10, 64.529, 11) --could be near a brick or in a new area
for i, v in pairs(game.Players:GetChildren()) do
v.Character.Torso.CFrame = CFrame.new(targeto + Vector3.new(0, i * 5, 0)) --add an offset of 5 for each character
end
end

function spawnMap()
        ChosenMap:Clone().Parent = game.Workspace
end

function deleteMap()
    game.Workspace:FindFirstChild(ChosenMap.Name):Destroy()
end

function GameTimer()
            local GameTime = 90
            wait(.1)
        while GameTime ~= 0 do
            for _, player in pairs(game.Players:GetChildren()) do
            wait(.1)
                local Var = game.Workspace.GuiText
                wait(.5)
                Var.Value = "Avoid The Sickness: " .. GameTime
                wait(.3)
                GameTime = GameTime - 1
            end
        end



end

function ChangeText(message)
    for _, player in pairs(game.Players:GetChildren()) do

        local Var = game.Workspace.GuiText
                wait(.5)
                Var.Value = message
                wait(.3)
    end
end

function AwardPlayers(Player)

     Player.leaderstats.sCoins.Value = Player.leaderstats.sCoins.Value + 25
     Player.LoadCharacter()
end

function Release()
    local sickClone = game.ServerStorage.DFDIllness:Clone()
    sickClone.Parent = game.Workspace
end

function DestroyClone()
    game.Workspace.DFDIllness:Destroy()
end






while wait(.1) do
    print("Start of Game Loop")
showIntro()
Intermission()
spawnMap()
stopIntro()
TeleportAllPlayers()
ChangeText("Teleporting Players...")
HideTimer()
Release()
GameTimer()
DestroyClone()
showIntro()
TeleportTo()
for _, players in pairs(game.Players:GetChildren()) do
    if players.Character.Torso.Material == "Plastic" then
        AwardPlayers(players)
    end
end
deleteMap()
stopIntro()
roundnumber = roundnumber + 1   



end



0
In many of your loops over all the players you are making the same change to the exact same object NumPlayers amount of times.  What is `game.Workspace.GuiText`?  Any chance that should be a unique GUI object for each player? BlackJPI 2658 — 8y

Answer this question