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 » Scripters
Home Search
 

Re: Another long script, sorry guys..

Previous Thread :: Next Thread 
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 07:27 PM
Ok, so for some reason.. The code itself works fine, it's just really glitchy and doesn't allow the "modes" to finish. So I added waits to see if that would counter it but nope, it doesn't.. Modes keep piling on top of each other and it keeps glitching everything. As well as where I use rotations, the rotations occur really slow.. Should I be using renderstepped?

local Modes = {"Regular","Border","RaR","RaB"}

local function Regular()
spawn(function()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") and v.Name == "Frame" then
spawn(function()
for i = 0,1,0.01 do
v.BorderColor3 = Color3.new(0,0,0)
v.BackgroundColor3 = Mode1:lerp(EndMode1,i)
wait()
end
for x = 0,1,0.01 do
v.BorderColor3 = Color3.new(0,0,0)
v.BackgroundColor3 = EndMode1:lerp(Mode1,x)
wait()
end
end)
end
end
end)
end

local function Border()
spawn(function()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") and v.Name == "Frame" then
spawn(function()
for i = 0,1,0.01 do
v.BackgroundColor3 = Color3.new(0,0,0)
v.BorderColor3 = Mode2:lerp(EndMode2,i)
wait()
end
for x = 0,1,0.01 do
v.BackgroundColor3 = Color3.new(0,0,0)
v.BorderColor3 = EndMode2:lerp(Mode2,x)
wait()
end
end)
end
end
end)
end

local function RotateR()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") then
spawn(function()
v.BorderColor3 = Color3.new(0,0,0)
v.BackgroundColor3 = Color3.new(1,1,1)
end)
spawn(function()
for pi = 0,180,1 do
v.Rotation = pi
wait()
end
end)
end
end
end

local function RotateB()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") then
spawn(function()
v.BackgroundColor3 = Color3.new(0,0,0)
v.BorderColor3 = Color3.new(1,1,1)
end)
spawn(function()
for pi = 0,180,1 do
v.Rotation = pi
wait()
end
end)
end
end
end

local Value = 20

while wait() do
wait(1)
local newMode = Modes[math.random(1,#Modes)]
wait(1)
--------[Mode 1]-----------------------

if newMode == Modes[1] then
Regular()
repeat wait(1)
Value = Value - 1
until Value == 0
if Value == 0 then
Value = 21
end

--------[Mode 2]-----------------------

elseif newMode == Modes[2] then
Border()
repeat wait(1)
Value = Value - 1
until Value == 0
Value = 21

--------[Mode 3]-----------------------

elseif newMode == Modes[3] then
RotateR()
repeat wait(1)
Value = Value - 1
until Value == 0
Value = 21

--------[Mode 4]-----------------------

elseif newMode == Modes[4] then
RotateB()
repeat wait(1)
Value = Value - 1
until Value == 0
Value = 21

end
wait()
end


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
30 Jul 2016 07:29 PM
They keep piling because you're using spawn() for everything

Formerly ToxicDominator - add 17,509 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 07:30 PM
Well, I figured spawn(function() had something to do with it, but what else should I use? Should I remove them altogether?


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 07:46 PM
Should I be using like coroutines or something?


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 07:49 PM
yes, you could use coroutines

local call = coroutine.wrap(function()

call() --runs coroutine

it's something like that

someone correct me


Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 07:51 PM
@Lord

I only use spawn(function() since it's basically coroutines but it fires itself.


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 07:52 PM
coroutines make better sense in my head

u would wrap a coroutine for every function and then just call whichever one you need to call

and they should all run nearly at the same time(not actually simultaneously, because they have to take turns running) but it will look identical


Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 07:53 PM
Yeah, and spawn(function() literally fires everything.. rip


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 07:54 PM
Refresh my brain, do you put coroutines inside the for loop, or outside of it?


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 07:56 PM
local Regular = coroutine.wrap(function()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") and v.Name == "Frame" then
spawn(function()
for i = 0,1,0.01 do
v.BorderColor3 = Color3.new(0,0,0)
v.BackgroundColor3 = Mode1:lerp(EndMode1,i)
wait()
end
for x = 0,1,0.01 do
v.BorderColor3 = Color3.new(0,0,0)
v.BackgroundColor3 = EndMode1:lerp(Mode1,x)
wait()
end
end)
end
end
end
end)

local Border = coroutine.wrap(function()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") and v.Name == "Frame" then
spawn(function()
for i = 0,1,0.01 do
v.BackgroundColor3 = Color3.new(0,0,0)
v.BorderColor3 = Mode2:lerp(EndMode2,i)
wait()
end
for x = 0,1,0.01 do
v.BackgroundColor3 = Color3.new(0,0,0)
v.BorderColor3 = EndMode2:lerp(Mode2,x)
wait()
end
end)
end
end
end
end)

local RotateR = coroutine.wrap(function()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") then
local color = coroutine.wrap(function()
v.BorderColor3 = Color3.new(0,0,0)
v.BackgroundColor3 = Color3.new(1,1,1)
end)
local rotate = coroutine.wrap(function()
for pi = 0,180,1 do
v.Rotation = pi
wait()
end
end)
color()
rotate()
end
end
end)

local RotateB = coroutine.wrap(function()
for i,v in pairs(SurfaceGui:GetChildren()) do
if v:IsA("Frame") then
local color = coroutine.wrap(function()
v.BackgroundColor3 = Color3.new(0,0,0)
v.BorderColor3 = Color3.new(1,1,1)
end)
local rotate = coroutine.wrap(function()
for pi = 0,180,1 do
v.Rotation = pi
wait()
end
end)
color()
rotate()
end
end
end



Add 13,000 posts
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 07:57 PM
take out all spawn functions, i missed some


Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:00 PM
Alright awesome, thanks dude! :D


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 08:01 PM
does it work or did i fail big time




Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:03 PM
You failed... rip..


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 08:04 PM
keep trying to mess around with it

i gave you a basic layout of how to use the coroutines


Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:05 PM
I know how to use coroutines but I thought spawn(function() would've done it here.


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
30 Jul 2016 08:06 PM
It would have, and I have no idea what you are trying to do here

Formerly ToxicDominator - add 17,509 posts
Report Abuse
NeonTurtle2001 is not online. NeonTurtle2001
Joined: 21 Jul 2013
Total Posts: 232
30 Jul 2016 08:07 PM
I would not have just one big code block...separate it into smaller blocks so its easier to debug the code.




anyways, buy this item:

https://www.roblox.com/The-Bluesteel-Bathelm-item?id=1172161
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:08 PM
@Lord

Another question, sorry.. But why does the rotation occur so slow? Where I rotate all the frames to 180.. It literally goes as slow as a snail...


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 08:10 PM
wait() = 1/30th of a second

you're iterating 1 degree/second

so it's going to go 30 degrees per second

which means it's going to take 6 seconds to make a 180 degree turn

increase the number from 1 to like 6


Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:11 PM
@Lord

No, sometimes it goes fast but sometimes it goes super, super, slow..


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Jul 2016 08:12 PM
if there's multiple coroutines running that might be why


Add 13,000 posts
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:12 PM
I also want to rotate smoothly, 6 makes it look chunky and ew


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:14 PM
Eh.. Your coroutines failed too, it worked correct for 1 mode and 1 mode only lol'd, the rotation modes work fine.


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
i_Movie is not online. i_Movie
Joined: 06 Apr 2014
Total Posts: 11725
30 Jul 2016 08:19 PM
I fixed them though


hi r u ok <-- See that right there? That's a stolen siggy!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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