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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: is this inefficient

Previous Thread :: Next Thread 
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
20 Aug 2015 03:45 PM
tweenJoint = function(Joint,NewC0,NewC1,Duration)
local StartC0 = Joint.C0
local StartC1 = Joint.C1
spawn(function()
local tweenIndication = nil
local NewCode = math.random(-1e9, 1e9)
if (not Joint:FindFirstChild('TweenIndication')) then
tweenIndication = Instance.new('IntValue')
tweenIndication.Name = 'TweenIndication'
tweenIndication.Value = NewCode
tweenIndication.Parent = Joint
else
tweenIndication = Joint.TweenIndication
tweenIndication.Value = NewCode
end
local num = 1/(Duration * 60)
for i=0,1,num do
if Joint:FindFirstChild('TweenIndication').Value == NewCode then
Joint.C1 = StartC1:lerp(NewC1,i)
Joint.C0 = StartC0:lerp(NewC0,i)
game:GetService("RunService").RenderStepped:wait()
else break end
end
if tweenIndication.Value == NewCode then
tweenIndication:Destroy()
end
end)
end


FilteringDisabled is for squares
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Aug 2015 04:00 PM
Yes, you aren't using local variables.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
20 Aug 2015 04:01 PM
..


FilteringDisabled is for squares
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Aug 2015 04:01 PM
It's also dependent on a consistent framerate, which is bad.
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Aug 2015 04:02 PM
wait ignore my first post i wasn't reading it right
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Aug 2015 04:03 PM
"It's also dependent on a consistent framerate, which is bad."
like pretty much everything (as everything slows down not just the render process).
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
20 Aug 2015 04:03 PM
^


FilteringDisabled is for squares
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Aug 2015 04:03 PM
@lord

What I meant was that the way he's doing it, it'll take someone with 30fps twice as long as someone with 60fps to complete the tween.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
20 Aug 2015 04:05 PM
@dermon,

that's unfortunate for them.


FilteringDisabled is for squares
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Aug 2015 04:07 PM
Oh, consistent across players. Isn't that what you'd expect from a player that's lagging? Well nontheless, I suppose coroutine.yield() would be better
Report Abuse
DermonDarble is not online. DermonDarble
Joined: 04 Jun 2015
Total Posts: 2576
20 Aug 2015 04:08 PM
It's easy enough to calculate alpha based on time.

local alpha = (tick() - startTick) / tweenTime
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