I made this round script for a round based game but whenever it finishes the intermission part it says a error "Attempt to call a nil value: Line 11" i dont understand the error so can u please help? Heres the script
local I = 30 local Hint = Instance.new("Hint") Hint.Parent = game.Workspace Hint.Name = "Intermission" while true do wait (1) I = I - 1 game.Workspace.Intermission.Text = "Intermission: "..I if I == 0 then local Round = 1 if Round == 1 then Round1() break end end end function Round1() for _, v in pairs(game.Players:GetChildren()) do v:WaitForChild("PlayerGui").ScreenGui.Frame.Visible = true local msg = "Welcome to the Lobby Event!" local text = msg local Texty = v:WaitForChild("PlayerGui").ScreenGui.Frame.TextLabel for i = 1,#text do Texty.Text = string.sub(text,1,i) local cor = coroutine.wrap(function() local sound = Instance.new("Sound") sound.Volume = .5 sound.SoundId = "rbxassetid://151715959" sound.Parent = v:WaitForChild("PlayerGui").ScreenGui sound:Play() sound.Ended:Wait() sound:Destroy() end) cor() wait(0.03) end wait (3) local msg = "In this event you do absolutely nothing :U" local text = msg local Texty = v:WaitForChild("PlayerGui").ScreenGui.Frame.TextLabel for i = 1,#text do Texty.Text = string.sub(text,1,i) local cor = coroutine.wrap(function() local sound = Instance.new("Sound") sound.Volume = .5 sound.SoundId = "rbxassetid://151715959" sound.Parent = v:WaitForChild("PlayerGui").ScreenGui sound:Play() sound.Ended:Wait() sound:Destroy() end) cor() wait(0.03) end wait (3) v:WaitForChild("PlayerGui").ScreenGui.Frame.Visible = false end end
Howdy!
The error basically says that you're referring to something that doesn't exist. From your script, it looks like you're trying to fire a function called Round1()
but the server is saying such a function doesn't exist. You need to put the function above the trigger so that the server knows to look back onto what you're talking about.
If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.