I’m trying to make a wall jump system that’s mostly on the client. I’m firing a remoteEvent to applyImpulse to the player’s HumanoidRootPart.
Client
function wallJump()
exitingWall = true
exitingWallTimer = exitingWallTime
local wallNormal = nil
if rightWallHit ~= nil then
wallNormal = rightWallHit.Normal
elseif leftWallHit ~= nil then
wallNormal = leftWallHit.Normal
end
if wallNormal ~= nil then
local forceToApply = hrp.CFrame.UpVector * wallJumpUpForce + wallNormal * wallJumpSideForce
events.ModifyAssemblyLinearVelocity:FireServer(hrp, Vector3.new(hrp.AssemblyLinearVelocity.X, 0, hrp.AssemblyLinearVelocity.Z))
events.ApplyImpulseToAssembly:FireServer(hrp, forceToApply)
print("Wall Jump Applied with Force: ", forceToApply)
end
end
Server
local events = game.ReplicatedStorage:WaitForChild("Events")
-- Function to apply impulse to the character's Assembly part
function applyImpulseToAssembly(setter, assemblyPart, impulseForce)
-- Check if the assemblyPart and impulseForce are valid
if assemblyPart and assemblyPart:IsA("BasePart") and impulseForce then
-- Print debug information to verify correct force application
print("Server received ApplyImpulse event.")
print("Impulse Force:", impulseForce)
-- Ensure that the assemblyPart belongs to the player
local character = setter.Character
if assemblyPart:IsDescendantOf(character) then
assemblyPart:ApplyImpulse(impulseForce)
else
warn("Invalid assemblyPart for player: ", setter)
end
else
warn("Invalid parameters passed to ApplyImpulseToAssembly.")
end
end
-- Function to modify the assembly's linear velocity
function modifyAssemblyLinearVelocity(setter, assemblyPart, assemblyVector3)
if assemblyPart and assemblyPart:IsA("BasePart") and assemblyVector3 then
print("Server received ModifyAssemblyLinearVelocity event.")
print("New Velocity Vector:", assemblyVector3)
-- Ensure that the assemblyPart belongs to the player
local character = setter.Character
if character and assemblyPart:IsDescendantOf(character) then
assemblyPart.AssemblyLinearVelocity = assemblyVector3
else
warn("Invalid assemblyPart for player: ", setter)
end
else
warn("Invalid parameters passed to ModifyAssemblyLinearVelocity.")
end
end
-- Connect the server functions to the events
events.ApplyImpulseToAssembly.OnServerEvent:Connect(applyImpulseToAssembly)
events.ModifyAssemblyLinearVelocity.OnServerEvent:Connect(modifyAssemblyLinearVelocity)
I’ve looked for solutions online but none of them are helping. Any help would greatly be appreciated!