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
|
  |
| 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
|
  |
| Joined: 02 Dec 2011 |
| Total Posts: 8931 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 02 Dec 2011 |
| Total Posts: 8931 |
|
|
| 11 Mar 2017 09:43 AM |
How am I supposed to loop it?
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 11 Mar 2017 10:29 AM |
| you forgot to set the parent of the BodyVelocity |
|
|
| Report Abuse |
|
|