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

Re: Position/CFrame never works

Previous Thread :: Next Thread 
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
01 May 2014 02:28 PM
Ive tried everything to have a part position itself at the mouse's position, but it never works. There are no errors, everything works fine except that the Cylinder appears at (0,0,0). Heres the script,


plyr = game.Players.LocalPlayer
--repeat wait() until plyr
mouse = plyr:GetMouse()
preCyl = script.Cylinder

function WheelF()
if preCyl.BrickColor.Number == 1020 then --green
preCyl.BrickColor = BrickColor.new("Really red")
elseif preCyl.BrickColor.Number == 1004 then --red
preCyl.BrickColor = BrickColor.new("Really blue")
elseif preCyl.BrickColor.Number == 1010 then --blue
preCyl.BrickColor = BrickColor.new("Lime green")
end
end
function WheelB()
if preCyl.BrickColor.Number == 1020 then --green
preCyl.BrickColor = BrickColor.new("Really blue")
elseif preCyl.BrickColor.Number == 1004 then --red
preCyl.BrickColor = BrickColor.new("Lime green")
elseif preCyl.BrickColor.Number == 1010 then --blue
preCyl.BrickColor = BrickColor.new("Really red")
end
end
--mouse.WheelForward:connect()
--mouse.WheelBackward:connect()
function greenCyl()
if mouse.Target ~= nil then
Cyl = Instance.new("Part",game.Workspace)
mesh = Instance.new("CylinderMesh",Cyl)
Cyl.Size = preCyl.Size
Cyl.BrickColor = preCyl.BrickColor
Cyl.Anchored = true
Cyl.CanCollide = false
Cyl.Position = Vector3.new(mouse.Hit) --Here
Cyl.FormFactor = "Custom"
wait()
Cyl:Destroy()
end
end


mouse.Move:connect(greenCyl)
mouse.Idle:connect(greenCyl)
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
01 May 2014 02:32 PM
bump
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
01 May 2014 02:36 PM
love me
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
01 May 2014 02:38 PM
Try:

Cyl.Position = mouse.Hit.p
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
01 May 2014 02:39 PM
Thanks, it works!
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
01 May 2014 02:40 PM
No, problem, that's how you would obtain a part's Vector3 equivalent of a CFRame. Vector3.new(CFrame) would not error, but would return 0,0,0.
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