refig334Join Date: 2009-05-31 Post Count: 43 |
When I do script.Parent do I capitalize the S like...
Script.Parent....
or
script.Parent
Answer fast! |
|
|
lowercase s.
script.Parent
But you MIGHT be allowed to use upper-case. I'm not sure. |
|
ninga95Join Date: 2008-07-16 Post Count: 5026 |
Just
script.Parent |
|
ninga95Join Date: 2008-07-16 Post Count: 5026 |
Beat me to it lol
'Floodcheck is annoying.." |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
then what's wrong with my script? It wont work
vip = game.Players.refig344
function onChatted(msg)
if msg == "Blue" then
script.Parent.BrickColor = BrickColor.new("Cyan")
elseif msg == "Red" then
script.Parent.BrickColor = BrickColor.new("Really red")
elseif msg == "Pink" then
script.Parent.BrickColor = BrickColor.new("Pink")
elseif msg == "Purple" then
script.Parent.BrickColor = BrickColor.new("Bright violet")
elseif msg == "Green" then
script.Parent.BrickColor = BrickColor.new("Bright green")
elseif msg == "Orange" then
script.Parent.BrickColor = BrickColor.new("Deep orange")
elseif msg == "Yellow" then
script.Parent.BrickColor = BrickColor.new("New Yeller")
elseif msg == "Normal" then
script.Parent.BrickColor = BrickColor.new("Medium stone grey")
elseif msg == "White" then
script.Parent.BrickColor = BrickColor.new("Institutional white")
end
end
vip.Chatted:connect(onChatted)
~~~~~~~~~
The parent is a brick. |
|
|
You would have to use a Script Builder for that. When the server starts, you aren't in Players.
vip = "refig334" -- your name.
function onChatted(msg)
if msg == "Blue" then
script.Parent.BrickColor = BrickColor.new("Cyan")
elseif msg == "Red" then
script.Parent.BrickColor = BrickColor.new("Really red")
elseif msg == "Pink" then
script.Parent.BrickColor = BrickColor.new("Pink")
elseif msg == "Purple" then
script.Parent.BrickColor = BrickColor.new("Bright violet")
elseif msg == "Green" then
script.Parent.BrickColor = BrickColor.new("Bright green")
elseif msg == "Orange" then
script.Parent.BrickColor = BrickColor.new("Deep orange")
elseif msg == "Yellow" then
script.Parent.BrickColor = BrickColor.new("New Yeller")
elseif msg == "Normal" then
script.Parent.BrickColor = BrickColor.new("Medium stone grey")
elseif msg == "White" then
script.Parent.BrickColor = BrickColor.new("Institutional white")
end
end
game.Players.PlayerAdded:connect(function(p)
if p.Name == vip then
p.Chatted:connect(onChatted)
end
end)
|
|
|
Sorry, to clarify, your script would only work in a script builder if the script builder script was in a part ._.
The modified version I gave you would work in an actual script. |
|
blanmanJoin Date: 2008-03-15 Post Count: 1750 |
if theres no output, it means that the script is running correctly, but its not doing what you expect it would... hate that.
Im not sure how chat-scripts work, but is the way you target yourself as a player correct? check it against another onchat script |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
Thanks, because, that just answered a whole lot of questions to my REAL identity. I'm a girl xD |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
By the way, why all the parentheses? Can I take them away? Or I need them on the last part. |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
When calling a function with a string or table, you don't need parenthesis.
However, when creating a function or connecting one to an event, you sure
do need one, brother.
BrickColor.new "Bright blue"
is valid.
function A B
end
is not valid. |
|
|
In the script I gave you, the parenthesis contain function arguments, which are passed by the event of a function.
something.Touched:connect(function(p)
When something is touched, connect to this function with the argument of what touched it. In the line that I just showed, 'p' is the argument of the function, which is what touched it in that function. |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
Oysi! Once again we meet. Oh shoot, I'm in my test account. Sorry, i'm deenaoziel. Anyway, are you always fourming? |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
Lol, you always call people "Sister, brother" When I was in deenaoziel I made a thread "yeah you need ..... Sister" Today "When an arg... Brother" |
|
oysi93Join Date: 2008-04-27 Post Count: 12469 |
In that case, sorry if I offended ya by sayin' brother, sister. xP
And yes, I am foruming a lot. =] I always wanna help, eh? =D |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
Lol, yeah I even have your Ro•Cleaner in my place right now. But what really bums me out is... O.O I can't enter! It keeps shutting down! Help? I shut it down after it says 0-8 players max and then I start new server "This game has shut down.." =.e? |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
Success :) I got in and it works. Anyone who wants to see my brick come. I'm so happy :D |
|
refig334Join Date: 2009-05-31 Post Count: 43 |
It's a project I want to sell. I just started off with the basic features. |
|
pwnedu46Join Date: 2009-05-23 Post Count: 7534 |
"But you MIGHT be allowed to use upper-case. I'm not sure."
(clarification)
That's not true. If you use Script instead of script, it will return a nil value because it assumes that "Script" is a child of DataModel, while "script" is the script itself (script.Parent, etc).This happened to me once or twice, so I try to be as specific as possible when using caps in scripts. |
|