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

I dont understand the error "Attempt to call a nil value". PLease explain to me?

Asked by
TNTIsLyfe 152
4 years ago

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

0
Your trying to do something that doesnt exist. You dont need the parameters after Round1 and change round1 to round. JesseSong 3916 — 4y
0
ok TNTIsLyfe 152 — 4y
0
what does that mean? TNTIsLyfe 152 — 4y
0
? TNTIsLyfe 152 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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.

Be sure to check out the Roblox API Documentation as well for additional reference.

0
oh cool ur idea worked TNTIsLyfe 152 — 4y
Ad

Answer this question