I am working on a game that relies on physics so the first that I thought to do was use assemblylinearvelocity it worked with no issues at all until I decided to add jump pads
jump pads are super inconsistent which makes it harder to get past those stages for new players
Here is the local script placed in startercharacterscripts
script.Parent.Humanoid.Touched:Connect(function(hit)
local HumanoidRootPart = script.Parent.HumanoidRootPart
if hit.Name == "Jump" and Db == false then
local Velocity = HumanoidRootPart.AssemblyLinearVelocity
HumanoidRootPart.AssemblyLinearVelocity = hit.CFrame.UpVector * 200 + Velocity
Db = true
task.wait(0.1)
Db = false
end
end)
I tried many things to get this working
-increasing assemblylinearvelocity using jumppad upvector
-setting it to a new value
-getting direction(cam.CFrame.LookVector) where player ragdolled then applying velocity using that and jumppad upvector
-getting hrp assemblylinearvelocity and adding that with jumppad upvector
Also, the way the player ragdolls himself is using assemblylinearvelocity too so that could be the issue but I don’t know if there are good alternatives that would work out with me
It’s a full game so I won’t be sharing the whole game I will just share the part related to ragdoll and jump pad tell me if anything isn’t clear in the script
local UIS = game:GetService("UserInputService")
local RagdollModule = require(game:GetService("ReplicatedStorage"):WaitForChild("Ragdoll"))
local CAS = game:GetService("ContextActionService")
local Cam = game.Workspace.CurrentCamera
local Db = false
local Ragdolled = false
local function UnRagdollOnStop(HumanoidRootPart)
local LastPosition = HumanoidRootPart.Position
while task.wait(0.5) do
if not HumanoidRootPart then break end
if Ragdolled == false then
break
end
local NewPosition = HumanoidRootPart.Position
local Distance = (NewPosition - LastPosition).Magnitude
if Distance <= 1 then
RagdollModule.UnRagdoll(script.Parent)
Ragdolled = false
break
else
LastPosition = NewPosition
end
end
end
local function Ragdoll(name,state,object)
if state == Enum.UserInputState.Begin then
local HumanoidRootPart = script.Parent.HumanoidRootPart
local Humanoid = script.Parent.Humanoid
if Ragdolled == false then
RagdollModule.Ragdoll(script.Parent)
HumanoidRootPart:ApplyImpulse(Cam.CFrame.LookVector * 650)
Ragdolled = true
end
UnRagdollOnStop(HumanoidRootPart)
end
end
CAS:BindAction("Ragdoll",Ragdoll,true,Enum.KeyCode.E,Enum.KeyCode.ButtonX)
local RagdollButton = CAS:GetButton("Ragdoll")
if RagdollButton then
RagdollButton.Size = UDim2.new(0.25, 0,0.3, 0)
end
CAS:SetTitle("Ragdoll","Ragdoll")
CAS:SetPosition("Ragdoll",UDim2.fromScale(0.15,0.3))
script.Parent.Humanoid.Touched:Connect(function(hit)
local HumanoidRootPart = script.Parent.HumanoidRootPart
if hit.Name == "Jump" and Db == false then
local Velocity = HumanoidRootPart.AssemblyLinearVelocity
HumanoidRootPart:ApplyImpulse(hit.CFrame.UpVector * 900)
Db = true
task.wait(0.1)
Db = false
elseif hit.Name == "Boost" and Db == false then
HumanoidRootPart.AssemblyLinearVelocity = hit.CFrame.LookVector * 100
Db = true
task.wait(0.1)
Db = false
end
end)
The only time i recommend using assemblylinearvelocity for physics is something like this (you can use this for moving platforms in your game btw):
game:GetService("RunService").RenderStepped:Connect(function(dt)
for _, platformData in pairs(movingPlatforms) do
local platform = platformData.part
local lastPos = platformData.lastPos
if lastPos then
platform.AssemblyLinearVelocity = (platform.Position - lastPos) / dt
else
platform.AssemblyLinearVelocity = Vector3.zero
end
platformData.lastPos = platform.Position
end
end)
and also, if you want less force on your LV, then do something like
Set VectorDirection to the current force you are applying
Then you can set Force_Multiplier to something like 0.5 for it to be a lot weaker (just so you know the force value doesnt work linearly, it has more of an exponential curve from what ive seen)