#dash help

1 messages · Page 1 of 1 (latest)

lean kettle
#
local DashModule = {}

local DashStop = 0.75

function ApplyDash(Character, DashDirection)
    local Attachment = Instance.new("Attachment", Character.HumanoidRootPart)
    Attachment.WorldPosition = Character.HumanoidRootPart.AssemblyCenterOfMass
    
    if DashDirection == "ForwardDash" then
        local LinearVel = Instance.new("LinearVelocity", Character.HumanoidRootPart)
        LinearVel.MaxForce = 100000
        LinearVel.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
        LinearVel.ForceLimitsEnabled = true
        LinearVel.ForceLimitMode = Enum.ForceLimitMode.PerAxis
        LinearVel.MaxAxesForce = Vector3.new(100000, 0, 100000)
        LinearVel.Attachment0 = Attachment
        LinearVel.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
        LinearVel.VectorVelocity = Character.HumanoidRootPart.CFrame.LookVector * 25
    end

    
    
    task.delay(DashStop, function()
        Attachment:Destroy()
    end)
end




function DashModule.Dash(Character, DashDirection)
if not Character then return end

if DashDirection == "ForwardDash" then
    print("forward dash")
    ApplyDash(Character, DashDirection)
end



end

return DashModule

can someone tell me why my dash isnt going forward??

rough lake
#

Can we see the script where you require the module?

lean kettle
#
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local MovementRemote = ReplicatedStorage.Remotes.MovementHandler


local Character = script.Parent
local Player = Players:GetPlayerFromCharacter(Character)
local Humanoid = Character.Humanoid


UserInputService.InputBegan:Connect(function(input, gpe)
    if gpe then return end
    
    if input.KeyCode == Enum.KeyCode.Q then
        if UserInputService:IsKeyDown(Enum.KeyCode.W) then
            MovementRemote:FireServer("Dash", "Dash", "ForwardDash")
        end
    end
    
end)



#

@rough lake

rough lake
#

and the script where you receive the dash remote?

lean kettle
#

this is in a server

#

script

#

that handles all my actions

#

local Players : Players = game:GetService("Players")
local RS : ReplicatedStorage = game:GetService("ReplicatedStorage")


local PlayerService = require(script.Modules.PlayerService) 
local Remotes = RS.Remotes

Players.PlayerAdded:Connect(function(player)
    
    player.CharacterAdded:Connect(function(character)
        character.Parent = workspace.Alive
    end)
end)

Remotes.ActionHandler.OnServerEvent:Connect(function(player, moduleName, methodName, ...)
    
    local playerObject = PlayerService.Get(player)

    
    playerObject:ExecuteAction(moduleName, methodName, ...)
end)

Remotes.MovementHandler.OnServerEvent:Connect(function(player, moduleName, methodName, ...)
    local playerObject = PlayerService.Get(player)
    
    playerObject:ExecuteAction(moduleName, methodName, ...)
    
end)
rough lake
#

You have 2 player services?

grizzled cloud
#

why r u doing dash on serverside

lean kettle
grizzled cloud
#

preferably not

lean kettle
grizzled cloud
lean kettle
#

dash client is for the input

#

server script is to call my modules / remotes

#

dash module is the dashs logics

grizzled cloud
#

another thing is to not use the second parameter of instance.new

lean kettle
#

okay so i should just set the parent

cerulean acornBOT
#

studio** You are now Level 1! **studio

lean kettle
#

in a line below

grizzled cloud
#

and also they task.delay can be called as such:
task.delay(DashStop, Attachment.Destroy, Attachment)

grizzled cloud
#

also my phone on 1%