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

Why is my Message Function erroring?

Asked by 10 years ago

I have been attempting to fix it, but it isn't work, and keeps saying the same error in the Output, the Output says 15:33:03.471 - local function Message(msg,type,time,str,par) local num = 0:4: attempt to index local 'par' (a nil value) 15:33:03.472 - Stack Begin 15:33:03.472 - Script 'local function Message(msg,type,time,str,par) local num = 0', Line 4 - local Message 15:33:03.473 - Script 'local function Message(msg,type,time,str,par) local num = 0', Line 28 15:33:03.474 - Stack End, but I still can't figure out what I'm doing wrong, here is the script;

local function Message(msg,type,time,str,par)
local num = 0 --This is used for the amount of time
local m = Instance.new(type)
for z,v in pairs(par:GetChildren()) do --For the Parent
if v then
m.Parent = v
end
end
if not time then --If the player is not using time
if str then --If the message does something like 'M' 'Me' 'Mes' 'Mess' 'Messa' 'Messag' 'Message'
for i = 1, #msg do
m.Text = tostring(msg:sub(1,i))
wait(1/19)
num = num + #msg/1/4
end
else --Elseif doesn't work the text to do that
m.Text = msg
end
wait(num)
else --Elseif there is time
wait(time)
end
if m ~= nil then
m:Destroy()
end
end

Message("Message function","Message",true,game.Players)

Answer this question