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

TextLabels won't appear?

Asked by 9 years ago

Hi everyone, recently I've been editing a premade script for a murder game. I'm trying to replace the messages with TextLabels. This is the script I have so far;

local Maps = game.ServerStorage.Maps:GetChildren()
local Players = game.Players
local Murderer = nil
local sherrif = nil
local Dead ={}
local Spawn = "Workspace.Center" -- input the path to your main spawn point where players enter the game
local MaxGameTime = 120 -- how long you want your game to run.(In seconds)
local ToggleGame = 1
local Knife = game.ServerStorage.Knife
local Pistol = game.ServerStorage.Pistol
local NotFinished = true
-- Main loop

m = Instance.new("TextLabel", game.StarterGui.ScreenGui.TextLabel)
m.Size = UDim2.new(0, 500, 0, 50) --Make sure to use UDim2, NOT Vector3
m.Position = UDim2.new(.5, -500, .5, -340)
m.Text = "Stuff" --Make sure this is a string
m.TextColor3 = (1, 1, 1)
m.BorderColor3 = (0, 0, 0)
m.BorderSizePixel = (1.5)
m.BackgroundColor3 = Color3.new(1, 1, 1) --GUIs only accept Color3 values, which range from 0 to 1. To convert other colors to Color3, divide each number by 255. In this case, white is (255, 255, 255) and 255/255 = 1.
m.BackgroundTransparency = (1)

function GameHandle()
        local Winner = ""
        if #Players:GetChildren() <2 then return "Must be at least two players"
        end
        Murderer = Players:GetChildren()[math.random(1,#Players:GetChildren())]
        Sherrif = Players:GetChildren()[math.random(1,#Players:GetChildren())]

        while Sherrif == Murderer do
            Sherrif = Players:GetChildren()[math.random(1,#Players:GetChildren())]
            Wait()
        end

        local Map = Maps[math.random(1,#Maps)]:Clone()
        Map.Parent = Workspace
        for _, P in ipairs(Players:GetChildren()) do P.Character:MoveTo(Map.PrimaryPart.Position) end
        local m 
        for i = 5,0 do
            m.Text = i
            Wait(1)
        end
        m:Destroy()

        Sherrif.Character.Humanoid:EquipTool(Pistol:Clone())
        Murderer.Character.Humanoid:EquipTool(Knife:Clone())

        Murderer.Character.Humanoid.Died:connect(function() end)

        local function CheckPlayers()  while true do if #Dead == (#Players:GetChildren() - 1) then return true end end end

        for _,z in ipairs(Players:GetChildren()) do
            Z.Died:connect(function()
                Died = Died + 1 
                if Died == #Players:getChildren() then
                     Winner = "Murderer"
                end
            end)
        end

        Murderer.Character.Died:connect(function() Winner = "Innocents" end)

        local Index = 0

        while Wait(1) do
            Index = Index + 1
            if Index == MaxGameTime then
                return "Innocents"
            end
        end

return Winner
end


while true do
    for _, P in ipairs(Players:GetChildren()) do P.Character:MoveTo(Workspace.Center.Position) end
    local m = Instance.new("TextLabel", game.StarterGui.ScreenGui.TextLabel)
    m.Text = GameHandle().." Wins!"
    Wait(2)
    m:Destroy()
    Wait(10)

end

I'm not sure why but when I play the game no Textlabels appear. What am I doing wrong and how can I fix it?

0
What does output say? IcyArticunoX 355 — 9y
0
00:54:40.251 - Use the new http api: no 00:54:49.806 - Lighting is not a valid member of DataModel 00:54:49.807 - Script 'Plugin_142440532.FPSCreator', Line 27 00:54:49.807 - Stack End 00:54:49.814 - Unable to create an Instance of type "StockSound" 00:54:49.815 - Script 'Plugin_142271845.Script', Line 20 00:54:49.815 - Stack End Loading Cutscene Editor... Loading Tree Gen... Finished Loading Tree TonyBlocks 0 — 9y
0
Are you sure that the output you copied is for this script? Try running the script again and copying the relevant errors in the output. It should say which line is causing the error. IcyArticunoX 355 — 9y
0
16:25:45.379 - --Main variables local Maps = game.ServerStorage.Maps:GetChildren() local Playe:19: ')' expected near ',' TonyBlocks 0 — 9y

Answer this question