generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Can't seem to get simple loop working

Previous Thread :: Next Thread 
mazejaker is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image