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

Can you tell me what I am doing wrong?

Asked by 9 years ago

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()
0
I edited your question to format the code block. Please remember to do this yourself in the future, using the Lua symbol on above the text editor. adark 5487 — 9y

3 answers

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

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.

0
ninja'd Goulstem 8144 — 9y
0
;P adark 5487 — 9y
0
thanks adark for the code but where od i place it on roblox studio? Kai33thakid 15 — 9y
0
You need a Script! First, right-click ServerScriptService in the Explorer pane, then click 'Insert', and then 'Script' in the menu that pops up! adark 5487 — 9y
View all comments (5 more)
0
Thanks for all of your help I will remember this for future scripts, and sure i would love to be tutored. Kai33thakid 15 — 9y
0
Please mark my answer as accepted, then. :) adark 5487 — 9y
0
i dont know how to do that, i was look eirlier Kai33thakid 15 — 9y
0
There is a button underneath my username to the right of this answer that should say "Accept Answer" adark 5487 — 9y
0
i am sorry i can find it, it may be different for the different computers Kai33thakid 15 — 9y
Ad
Log in to vote
3
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Code Fixes

  • There is no instance type of Welcome, you need to make it Message.

  • Properties are case sensitive! Message.text should be message.Text.


Efficiency Fixes

  • Remove is deprecated, use Destroy.

  • There's a second argument of the Instance.new function, the parent.


Code

local Message = Instance.new("Message",workspace)
Message.Text = "Welcome"
wait(5)
Message:Destroy()
Log in to vote
-2
Answered by 9 years ago

Change

Message.text = "Welcome"

to

Message.Text = "Welcome"

Also use ':Destroy()' instead of ':Remove()' It's better and reliable.

Answer this question