I made dash script that uses BodyVelocity. All is okay, but when player jumps and uses dash, BV Velocity becomes twice as big. How do I can fix this?
Thanks!
I made dash script that uses BodyVelocity. All is okay, but when player jumps and uses dash, BV Velocity becomes twice as big. How do I can fix this?
Thanks!
If the humanoid floor material is air, just divide the velocity by 2.
I tried to do this, but nothing changed
Ok well, you should be using linear velocity anyways and not bv, but let’s say you stick w bv. Could you show me how you try to change it?
i tried to use linearVelo, but the same problem
local hum:Humanoid = char:FindFirstChildOfClass("Humanoid")
local bv
local db = false
local w = false
local s = false
local a = false
local d = false
local oldVelo
hum:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
if hum.FloorMaterial == "Air" then
if bv ~= nil then
oldVelo = bv.Velocity
bv.Velocity = bv.Velocity/2
end
else
if bv ~= nil then
if oldVelo ~= nil then
bv.Velocity = oldVelo
oldVelo = nil
end
end
end
end)
Creating bv:
if not db then
db = true
delay(.8, function()
db = false
end)
local velo = 0
local velo2 = 0
local notair = 130
if w and not s then
velo = root.CFrame.lookVector*notair
elseif not w and s then
velo = -root.CFrame.lookVector*notair
end
if a and not d then
velo2 = -root.CFrame.RightVector*notair
elseif not a and d then
velo2 = root.CFrame.RightVector*notair
end
if velo == 0 and velo2 == 0 then
velo = root.CFrame.LookVector*notair
elseif velo == 0 and velo2 ~= 0 then
velo = Vector3.new(0,0,0)
end
if velo2 == 0 then
velo2 = Vector3.new(0,0,0)
end
bv = Instance.new("BodyVelocity", root)
bv.MaxForce = Vector3.new(1, 0, 1)*30000
if game.UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
bv.Velocity = velo+velo2
else
bv.Velocity = root.CFrame.lookVector*notair
end
bv.P = 0
game.Debris:AddItem(bv, 0.08)
end
When the bv is created, check if the floor material is air. If it is, do notair/2.
nah, nothing changed
dftghethetrhethetyjyryjkryjk
yooo, I got a solution, but maybe it is a bit hard, so:
-- variables (not all)
local bv
local old_bv
local got_changed = false
local db = false
--checking changed
hum:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
if bv ~= nil and old_bv ~= nil then
if hum.FloorMaterial == Enum.Material.Air then
bv.Velocity = old_bv/2
got_changed = true
else
bv.Velocity = old_bv
got_changed = false
end
end
end)
--creating
if not db then
got_changed = false
db = true
delay(.8, function()
db = false
end)
local velo = 0
local velo2 = 0
local notair = 130
if w and not s then
velo = root.CFrame.lookVector*notair
elseif not w and s then
velo = -root.CFrame.lookVector*notair
end
if a and not d then
velo2 = -root.CFrame.RightVector*notair
elseif not a and d then
velo2 = root.CFrame.RightVector*notair
end
if velo == 0 and velo2 == 0 then
velo = root.CFrame.LookVector*notair
elseif velo == 0 and velo2 ~= 0 then
velo = Vector3.new(0,0,0)
end
if velo2 == 0 then
velo2 = Vector3.new(0,0,0)
end
bv = Instance.new("BodyVelocity", root)
bv.MaxForce = Vector3.new(1, 0, 1)*30000
if game.UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
bv.Velocity = velo+velo2
else
bv.Velocity = root.CFrame.lookVector*notair
end
old_bv = bv.Velocity
if got_changed == false then
bv.Velocity /= 2
end
delay(0.08, function()
bv:Destroy()
bv = nil
old_bv = nil
end)
end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.