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
 

Float/bob script

Previous Thread :: Next Thread 
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
11 Oct 2013 10:08 PM
So, I've tried this numerous times in the past, and it never works, no matter what I try. It's a script that will take all bricks in a model and bob them up and down. This method doesn't seem to work:

while true do
for i = 1, 100 do
--stuff
end
for i = 1, 100 do
--more stuff
end
end

-------------------------------------------------------------------------------

Any different, better methods of doing this? (maybe for i, v in pairs do?)

Thanks for any help,
-Bogy
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
11 Oct 2013 10:52 PM
That method will work.

Can you post the 'stuff' and 'more stuff'? That's where your problem is likely to be.
Report Abuse
Excellus is not online. Excellus
Joined: 17 Jun 2013
Total Posts: 3939
11 Oct 2013 10:54 PM
If seriously used that as a script, I've lost my faith in humanity.
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
12 Oct 2013 11:28 AM
Whole script:
-------------------------------------------------------------------------------------------------------------------------------
blocks = script.Parent:GetChildren()
while true do
for i = 1, 100 do
for i = 1, #blocks do
if blocks.ClassName == "Part" then
blocks.Mesh.Offset = blocks.Mesh.Offset + Vector3.new(0, 0.01, 0)
end
end
wait()
end

for i = 1, 100 do
for i = 1, #blocks do
if blocks.ClassName == "Part" then
blocks.Mesh.Offset = blocks.Mesh.Offset - Vector3.new(0, 0.01, 0)
end
end
wait()
end
wait()
end
-------------------------------------------------------------------------------------------------------------------------------
Note: This script DOES have correct indentation, it just won't show up here.

I can't seem to find any reason why this script won't work.
-Bogy
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
12 Oct 2013 12:27 PM
Help Please?
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
12 Oct 2013 01:00 PM
Really? No one here knows how to help me?

Come on, guys! I'm not asking you to make a whole giant script for me, just please tell me what I have to do to fix this, there is no reason that I can see as to why this won't work.
Report Abuse
Oozlebachr is not online. Oozlebachr
Joined: 30 Aug 2009
Total Posts: 22223
12 Oct 2013 01:03 PM
blocks = script.Parent:GetChildren()
while true do
for i = 1, 100 do
for i,v in ipairs(blocks) do
if v.ClassName == "Part" then
v.Mesh.Offset = v.Mesh.Offset + Vector3.new(0, 0.01, 0)
end
end
wait()
end

for i = 1, 100 do
for i,v in ipairs(blocks) do
if v.ClassName == "Part" then
v.Mesh.Offset = v.Mesh.Offset - Vector3.new(0, 0.01, 0)
end
end
wait()
end
wait()
end
Report Abuse
Oozlebachr is not online. Oozlebachr
Joined: 30 Aug 2009
Total Posts: 22223
12 Oct 2013 01:04 PM
as for the reasoning:
blocks is a table and you were trying to edit the properties of the table itself
edit the properties of everything inside a table by using for i,v in ipairs(table) do
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
12 Oct 2013 01:13 PM
I see, testing it out now...
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
12 Oct 2013 01:14 PM
It works! Thanks :D
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