Hello! I am Domderp999. The Creator of a future game, “Volcano Madness,” In it, there is a jetpack… Currently I am struggling with BodyVelocity issues. When I equip the Jetpack tool, It works normally, but when I un-equip it and equip it again, the BodyVelocity’s vector3 doubles … And when i unequip and equip more and more, the body velocity’s value gets higher. The Code:
script.Parent.Equipped:Connect(function()
---------------
-- Variables --
local FlightSpeed = 75
local ThrustPower = 10000
-- Variables
---------------
local bodyForce = Instance.new("BodyForce")
local Player = game.Players.LocalPlayer
bodyForce.Force = Vector3.new(0,0,0)
bodyForce.Parent = script.Parent.Handle
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.Space then
bodyForce.Force = Vector3.new(0,ThrustPower,0)
Player.Character.Humanoid.WalkSpeed = FlightSpeed
end
end)
UIS.InputEnded:Connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.Space then
bodyForce.Force = Vector3.new(0,0,0)
Player.Character.Humanoid.WalkSpeed = 16
end
end)
end)```
--What is my issue? Im unsure, but I think its this line :
bodyForce.Force = Vector3.new(0,ThrustPower,0)
--And if you find that that is the issue, how could I fix it?