mazejaker
|
  |
| Joined: 15 Aug 2008 |
| Total Posts: 2520 |
|
|
| 22 Sep 2014 08:01 AM |
I haven't scripted anything in Roblox for a loooong time, and today, I was trying to create a simple loop script which basically changed a Model's name so it would display as if they were talking (the model has a Humanoid and a Head of course).
At first I thought maybe the while true do loop was no loger correct, so I searched for other loop types on the Roblox wiki, none of them seemed to work either.
Basically, this is the scipt I have
name = script.Parent.Name
(loop type here) wait(15) name = "Feel free to browse my wares" wait(5) name = "Shopkeeper" ('end' or other closing statement)
Can anyone think why this isn't working? Can you not directly change a Name anymore or something? Is there some Syntax I have forgotten? |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 22 Sep 2014 08:04 AM |
Output?
Also, do you actually wait 15 seconds?
while true do / repeat wait(5) name = "Feel free to browse my wares" wait(5) name = "Shopkeeper" end / until false
|
|
|
| Report Abuse |
|
|
mazejaker
|
  |
| Joined: 15 Aug 2008 |
| Total Posts: 2520 |
|
|
| 22 Sep 2014 08:06 AM |
| I changed the timers to about 3 seconds when testing so I wouldn't have to wait, nothing happens, and there is no output :/ |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 22 Sep 2014 08:07 AM |
| Instead of "name = script.Parent.Name" use for example "char = script.Parent" and when you need to change the name use char.Name |
|
|
| Report Abuse |
|
|
mazejaker
|
  |
| Joined: 15 Aug 2008 |
| Total Posts: 2520 |
|
|
| 22 Sep 2014 08:10 AM |
| Oooh that worked, thanks! So I guess in future I shouldn't just try to call up a Variable on it's own? |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 22 Sep 2014 08:17 AM |
For example this won't work:
t = Workspace.BasePlate.Transparency
t = 1
So you can't use Variables to shorten Properties. |
|
|
| Report Abuse |
|
|
mazejaker
|
  |
| Joined: 15 Aug 2008 |
| Total Posts: 2520 |
|
|
| 22 Sep 2014 08:21 AM |
Yeah, I'm certain it used to work, although as I said I haven't scripted in a long time.
Thanks for your help! |
|
|
| Report Abuse |
|
|
mazejaker
|
  |
| Joined: 15 Aug 2008 |
| Total Posts: 2520 |
|
|
| 22 Sep 2014 09:08 AM |
I actually have just thought of another question if you could help, if I want the Name to change on a random timer, so any time between 15 seconds and 30 seconds, would this work:
chat = script.Parent
repeat wait(math.random(15,30)) chat.Name = "Hi, my name is Bob." wait(5) chat.Name = "" until false
I tested it briefly, changing the times to (1,5) but it seems to just wait 5 every time. So I feel like maybe this doesn't work |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 22 Sep 2014 09:30 AM |
| Put math.randomseed(tick()) on top of the script. |
|
|
| Report Abuse |
|
|
mazejaker
|
  |
| Joined: 15 Aug 2008 |
| Total Posts: 2520 |
|
|
| 22 Sep 2014 09:39 AM |
| Oh, okay, and what does that do? Just for future reference. Thanks again by the way! |
|
|
| Report Abuse |
|
|