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?