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: Why does this get stuck at 66?

Previous Thread :: Next Thread 
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
10 Feb 2017 04:53 PM
game:GetService("RunService").RenderStepped:connect(function() -- Flashy animation
if SelectedGun == 0 then
Selector.Visible = false
return false
end
Selector.Visible = true
local TargetSelectorPosition = SelectedGun == 1 and 0 or 70
Selector.Position = UDim2.new(0, Selector.Position.X.Offset + ((TargetSelectorPosition - Selector.Position.X.Offset) / 5), 0, 15)
end)

!!?? It should move the selector one 5 of the way closer to it's target each time, but get's stuck at 66 when going from 0 - 70, but always hits 0.

Any ideas?


AutoCarrot// Private Drive - Residents Only
Report Abuse
TehIcyStar is not online. TehIcyStar
Joined: 07 Mar 2010
Total Posts: 1649
10 Feb 2017 05:24 PM
oh my god this is a bit painful for me

Can't you use RenderStep:wait() in a for loop for the animation?

or, better yet, use :TweenPosition() ?

http://wiki.roblox.com/index.php?title=API:Class/GuiObject/TweenPosition
Report Abuse
Real_Spooky is not online. Real_Spooky
Joined: 23 Oct 2013
Total Posts: 3149
10 Feb 2017 05:25 PM
Figure it out yourself, Mr. Yale Graduate
Report Abuse
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
10 Feb 2017 05:27 PM
No, I want to break it half way through, as well as keeping the functionality of making the selector invisible w/o a bunch of conditionals. But I'll do it a different way


AutoCarrot// Private Drive - Residents Only
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
10 Feb 2017 05:27 PM
^ someone doesnt know what a joke is Downgrading STF ## ####################################################################
Report Abuse
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
10 Feb 2017 05:27 PM
Also, @Real, I also claimed I was God, so I mean like, I hope you're baiting me now?


AutoCarrot// Private Drive - Residents Only
Report Abuse
Real_Spooky is not online. Real_Spooky
Joined: 23 Oct 2013
Total Posts: 3149
10 Feb 2017 05:29 PM
Yes, I'm baiting. But I'm both:
1) Too stupid to figure this out
2) Too lazy to attempt to figure it out
Report Abuse
Treeecow is not online. Treeecow
Joined: 10 Jun 2011
Total Posts: 5161
10 Feb 2017 05:30 PM
:tweenposition()?
Report Abuse
TehIcyStar is not online. TehIcyStar
Joined: 07 Mar 2010
Total Posts: 1649
10 Feb 2017 05:30 PM
I'd help but I can't for the life of me figure out what this god forsaken line is

local TargetSelectorPosition = SelectedGun == 1 and 0 or 70

I've never seen syntax like this before.
Report Abuse
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
10 Feb 2017 05:32 PM
############################################################ Scroll right down to the ###### ############ ####### Drive - Residents Only
Report Abuse
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
10 Feb 2017 05:32 PM
Excellent

This was the link: http://wiki.roblox.com/index.php?title=Conditional_statement

Go to the bottom


AutoCarrot// Private Drive - Residents Only
Report Abuse
DeepBlueNoSpace is online. DeepBlueNoSpace
Joined: 24 Oct 2013
Total Posts: 6279
10 Feb 2017 05:37 PM
I always share solutions, but idk how much this will help future people :/

function HandleSelector()
if SelectedGun > 0 then
Selector.Visible = true
if Sequence.Get("GunAnim") then
Sequence.Stop("GunAnim")
Sequence.Delete("GunAnim")
end
Sequence.New("GunAnim", .1)
Sequence.NewAnim("GunAnim", 0, Selector, "Position", SelectedGun == 1 and 0 or 70, SelectedGun == 1 and 70 or 0, "inCubic", .1)
Sequence.Start("GunAnim")
Sequence.Wait("GunAnim")
if Sequence.Get("GunAnim") then
Sequence.Stop("GunAnim")
Sequence.Delete("GunAnim")
end
else
Selector.Visible = false
end
end


AutoCarrot// Private Drive - Residents Only
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