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: rotaing an object when touched

Previous Thread :: Next Thread 
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 07:53 PM
My script works. The problem is that when I touch it, it shakes and acts trippy. Here is the script:

local brick = script.Parent
local start = brick.Rotation
local endPos = start+Vector3.new(0,360,0)
local enabled = false

brick.Touched:connect(function()
if not enabled then
enabled = true
for i=0, 1, .01 do
brick.Rotation = start:lerp(endPos, i)
wait()
end
end
enabled = false
end)

Thanks in advance!
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:05 PM
bbuuuuummmmmmppppp
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
06 Aug 2015 08:13 PM
part.CFrame = part.CFrame * CFrame.Angles(sin(90),0,0)


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
06 Aug 2015 08:16 PM
local brick = script.Parent
local start = brick.Rotation
local endPos = start+Vector3.new(0,360,0)
local enabled = false

brick.Touched:connect(function()
if not enabled then
enabled = true
for i=0, 1, .01 do
brick.Rotation = start:lerp(endPos, i)
wait()
end
enabled = false
end
end)

set enabled to false only when your for loop is done

Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:21 PM
Unknown Global "sin"
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
06 Aug 2015 08:23 PM
did you not try mine
Report Abuse
airstriker4 is not online. airstriker4
Joined: 27 Jul 2012
Total Posts: 5831
06 Aug 2015 08:23 PM
math.sin()

ToxicDominator - 11,060 posts
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:26 PM
@instawin Just did. It resolves the shakiness, but I am able to make go up when I hit it.
Report Abuse
airstriker4 is not online. airstriker4
Joined: 27 Jul 2012
Total Posts: 5831
06 Aug 2015 08:27 PM
it's because he used Vector3
replace sin with math.sin

ToxicDominator - 11,060 posts
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:30 PM
@airstriker4 Cool! That worked but is there a way to make it go slower? Without increasing the wait time??
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
06 Aug 2015 08:31 PM
math.sin(70)
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:34 PM
That did nothing... Here is my script:

local brick = script.Parent
local enabled = false

brick.Touched:connect(function()
if not enabled then
enabled = true
for i=0, 1, .01 do
brick.CFrame = brick.CFrame*CFrame.Angles(0,math.sin(70),0)
wait()
end
enabled = false
end
end)
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:43 PM
bbuuuuummmmppppp 2
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 08:59 PM
PLEASE HELP
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
06 Aug 2015 09:08 PM
.....
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