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

Message should be removed, but it isn't?

Asked by 9 years ago

(Last question of the day!)

I have an error here that means that the message isn't removed. Anyone know why?

function message(text,time) --Message Function
    local msg = Instance.new("Message",workspace)
    msg.Text = text
    game:GetService("Debris"):AddItem(Message, time)--Same thing
end

This code works with hints, but not messages. Anyone see why?

message("THE RACE HAS BEGUN!!!!!", 3)

This is how the function is referenced in later parts of the script.

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

Your error is on line 4.

The AddItem method of Debris takes an object reference and, optionally, a time.

You're trying to pass in Message, which is an undefined variable. You should instead pass in msg:

game:GetService("Debris"):AddItem(msg, time)
0
Fair enough! Thanks for that. Michael007800 144 — 9y
Ad

Answer this question