i have bought a book and looked all over the wiki. this still give me no help to making a script. I have done the simple "message script" this is what i have been told to do (my message is "Welcome")Am i in some way doing some thing incorrect? If so please tell me what parts and what i can do to fix them. Also can someone tell me how do get a code to start working? :/
local Message = Instance.new("Welcome") Message.text = "Welcome" Message.Parent = game.Workspace wait(5) Message:Remove()
Instance.new()
create a new ROBLOX Object (like Parts or Models, for example). 'Welcome' is not a valid ROBLOX Object type, so it can't be created. However, 'Message' is a valid ROBLOX Object type.
There are a few more errors that I fixed in the below code:
local Message = Instance.new("Message") Message.Text = "Welcome" --text is not a valid property name. Text is. Remember, Lua is case-sensitive! Message.Parent = game.Workspace wait(5) Message:Destroy() --Remove() works but should not be used. Use Destroy() instead!
Additionally, Instance.new()
takes a second argument: where to put the newly created ROBLOX Object:
local Message = Instance.new("Message", game.Workspace) Message.Text = "Welcome" wait(5) Message:Destroy()
Feel free to PM me on ROBLOX if you would like some personal Lua tutoring, I'd be happy to help!
Also feel free to keep posting specific Lua question on this forum, most everyone here will try to help you fix your code.
There is no instance type of Welcome
, you need to make it Message
.
Properties are case sensitive! Message.text
should be message.Text
.
Remove
is deprecated, use Destroy
.
There's a second argument of the Instance.new
function, the parent.
local Message = Instance.new("Message",workspace) Message.Text = "Welcome" wait(5) Message:Destroy()
Change
Message.text = "Welcome"
to
Message.Text = "Welcome"
Also use ':Destroy()' instead of ':Remove()' It's better and reliable.