I can't seem to make a msg function
Please help me
function msg()
end m = Instace.new("Message", game.Workspace) m.Text = "Howdy, Y'all!" wait(5) m:Remove()
I can't seem to make a msg function
Please help me
function msg()
end m = Instace.new("Message", game.Workspace) m.Text = "Howdy, Y'all!" wait(5) m:Remove()
Lol, I see you're new to scripting. Technically, you're supposed to put your code in a code block and ask what's going wrong and give the output; and not ask for scripts. I'll give you this one, but don't expect people to give you scripts.
function createMessage(text, waitTime)
local message = Instance.new("Message", workspace) --creates Message object and puts in in Workspace
message.Text = text --sets message text to text value (look on line 1)
wait(waitTime) --waits for waitTime --(again, line 1)
message:destroy() --destroys message
end
--The beauty of this function is that you can specify the text and time it will last.
createMessage("Howdy, Y'all!", 5) --calls function, you MUST call function, obviously, or nothing will happen
EDIT: I added an explanation because LordDragonZord :I
yumtaste, you need to explain it like how I did, also this script can be MUCH simpler.
You need to explain how the script works. Just posting the script isn't going to help him learn.
Geez. Don't downvote me just because I didn't explain...
I kinda have too, unless you've read all the rules, I wouldn't of downvoted you. I'm just doing what the rules tell me to do.
Why do I have so many downvotes if my answer is right AND explained...
game.Workspace you can just type workspace.function msg() --Keep the code in between function and end.
local m = Instace.new("Message", workspace) --workspace is a shortcut for game.Workspace
m.Text = "Howdy, Y'all!"
wait(5)
m:Destroy() --Destroy instead of remove
end
msg() --Call the function
One lined script; Hard to read
function msg() local m = Instace.new("Message", workspace) m.Text = "Howdy, Y'all!" wait(5) m:Destroy() end msg()
7 lined script; easy to read
function msg()
local m = Instace.new("Message", workspace)
m.Text = "Howdy, Y'all!"
wait(5)
m:Destroy()
end
msg() --7 lined but easy to read.
Hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
PaperVex, please see all of the answers. The first answer posted isn't always the right answer, he didn't explain how this script works.