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
 

Having trouble with BodyVelocity

Previous Thread :: Next Thread 
DataFlame is not online. DataFlame
Joined: 02 Dec 2011
Total Posts: 8931
11 Mar 2017 09:19 AM
I'm currently trying to make something using BodyVelocity and I'm having trouble getting it to work. Can anyone point out my mistake?

My code:

local livingPart = game.Workspace.Part

function onClicked()
local explosion = Instance.new("Explosion", game.Workspace)
explosion.Position = livingPart.Position
livingPart.BrickColor = BrickColor.Yellow()
livingPart.Material = Enum.Material.Neon
livingPart.ClickDetector:Destroy()
wait(0.7)
explosion:Destroy()
end

livingPart.ClickDetector.MouseClick:Connect(onClicked)

if livingPart.Material == Enum.Material.Neon then
while true do
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyVelocity.velocity = Vector3.new(0, 3, 0)
wait(0.2)
bodyVelocity.velocity = Vector3.new(0, -3, 0)
end
end


Report Abuse
DataFlame is not online. DataFlame
Joined: 02 Dec 2011
Total Posts: 8931
11 Mar 2017 09:19 AM
Forgot to mention I'm trying to make the Part float up and down.


Report Abuse
DataFlame is not online. DataFlame
Joined: 02 Dec 2011
Total Posts: 8931
11 Mar 2017 09:35 AM
bump?


Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
11 Mar 2017 09:37 AM
math.huge isnt a number. It is infinite but if you have this

print(math.huge)

it will print "inf"
Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
11 Mar 2017 09:37 AM
Don't use math.huge when applying force. I think it will glitch it
Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
11 Mar 2017 09:40 AM
while true do
local bodyVelocity = Instance.new("BodyVelocity")

Never do this.



Report Abuse
DataFlame is not online. DataFlame
Joined: 02 Dec 2011
Total Posts: 8931
11 Mar 2017 09:43 AM
How am I supposed to loop it?


Report Abuse
Zylez is not online. Zylez
Joined: 26 Mar 2016
Total Posts: 417
11 Mar 2017 10:22 AM
if livingPart.Material == Enum.Material.Neon then
local bodyVelocity = Instance.new("BodyVelocity", livingPart)
while true do
bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyVelocity.velocity = Vector3.new(0, 3, 0)
wait(0.2)
bodyVelocity.velocity = Vector3.new(0, -3, 0)
end
end
Report Abuse
IcedVapour is not online. IcedVapour
Joined: 10 Nov 2013
Total Posts: 2741
11 Mar 2017 10:29 AM
you forgot to set the parent of the BodyVelocity
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