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 » Scripting Helpers
Home Search
 

Rotation ontouch?

Previous Thread :: Next Thread 
CarlosMX is not online. CarlosMX
Joined: 30 Apr 2011
Total Posts: 791
21 Sep 2013 06:51 PM
Hi, I'm trying to make this script, so that when a model touches the brick, the model rotates, the thing is, the model bricks are unanchored, so i dont want it falling apart either.
The script doesnt' seem to work, no output either.

function onTouched(hit)
for _, v in pairs (hit:GetChildren()) do
v.Rotation = Cframe.new(0, 30, 0)
hit:MakeJoints()
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Sep 2013 06:51 PM
If it's unanchored, it will fall.

Just do:

v.CFrame = v.CFrame * CFrame.angles(0, 30, 0)
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
21 Sep 2013 06:53 PM
function onTouched(hit)
for _, v in pairs (hit:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
v.CFrame = v.CFrame * CFrame.new(0, 30, 0)
coroutine.wrap(function() wait(1/15)v.Anchored=false;end)
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
CarlosMX is not online. CarlosMX
Joined: 30 Apr 2011
Total Posts: 791
21 Sep 2013 07:11 PM
Still won't rotate
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