UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed or Cooldown then return end
holdingKeys[input.KeyCode] = true
if input.KeyCode == Enum.KeyCode.Q then
if holdingKeys[Enum.KeyCode.W] then
Key = "Forward"
elseif holdingKeys[Enum.KeyCode.A] then
Key = "Left"
elseif holdingKeys[Enum.KeyCode.S] then
Key = "Backwards"
elseif holdingKeys[Enum.KeyCode.D] then
Key = "Right"
else
Key = "None"
end
Cooldown = true
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
--[[
local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")
local animations = {
Anim1 = ReplicatedStorage.Animations:WaitForChild("M1"),
Anim2 = ReplicatedStorage.Animations:WaitForChild("M2"),
Anim3 = ReplicatedStorage.Animations:WaitForChild("M3"),
Anim4 = ReplicatedStorage.Animations:WaitForChild("M4")
}
local animationToPlay = animations["Anim" .. Anim2]
if animationToPlay and animationToPlay:IsA("Animation") then
animator:LoadAnimation(animationToPlay):Play()
else
warn("Animation not found or invalid: " .. "Anim" .. Anim2)
end
--]]
-- Fire server with the direction key and current CFrame
Remote2:FireServer(Key, hrp.CFrame, hrp)
--[[Anim2 += 1
if Anim2 > 2 then
Anim2 = 1
end
task.wait(CooldownTime)
Cooldown = false
task.delay(1.5, function()
Anim2 = 1
end)]]
end
end)
UIS.InputEnded:Connect(function(input)
holdingKeys[input.KeyCode] = nil
end)
#Dashing
1 messages · Page 1 of 1 (latest)
im trying to make front, back and side dashses am i on the right track?
my code seems to not be working
Remote2.OnServerEvent:Connect(function(player, key, cf, hrp)
if Busy then return end
Busy = true
local combat = Combat.new(0, 5)
local function Stun(target)
combat:Stun(target)
end
if key == "Forward" then
KnockBackModule.Knockback(cf, cf.LookVector, 10)
Stun(hrp)
elseif key == "Left" then
KnockBackModule.Knockback(cf, -cf.RightVector, 10)
Stun(hrp)
elseif key == "Right" then
KnockBackModule.Knockback(cf, cf.RightVector, 10)
Stun(hrp)
elseif key == "Backwards" then
KnockBackModule.Knockback(cf, -cf.LookVector, 10)
Stun(hrp)
end
task.delay(1, function()
Busy = false
end)
end)
this is the server script
tell me if i did any silly mistakes cuz im a beginner 😭
why are you handling movements in server
to make it uncheatable?
yeah but you're complicating it yourself
would it matter though
people can just report them to your community server
whats exactly not working
do yall think this is fire
try not to pass humanoidrootpart from client to server, use the player argument from the remote event, get the player's character then humanoidrootpart
whats the third argument in knockblackmodule.knockback()
function module.Knockback(Char, Direction, Force)
if not Char or not Char:FindFirstChild("HumanoidRootPart") then return end
local HRP = Char.HumanoidRootPart
if HRP:FindFirstChild("RootRigAttachment") then
HRP.AssemblyLinearVelocity = Vector3.new(HRP.AssemblyLinearVelocity.X, 0, HRP.AssemblyLinearVelocity.Z)
end
local attachment = Instance.new("Attachment")
attachment.Parent = HRP
local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.Attachment0 = attachment
linearVelocity.VectorVelocity = Direction.Unit * Force
linearVelocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
linearVelocity.MaxForce = math.huge
linearVelocity.Parent = HRP
game.Debris:AddItem(linearVelocity, 0.2)
game.Debris:AddItem(attachment, 0.2)
end
force
try increasing it
did you debug your holdingkeys table
is the table storing any enum keys
last time i tried doing this and it doesnt work had to use other method
What method u use?
using Enum.Keycode.KEY.Value as index to store the variable in table
you could use humnoid.movedirection instead
gonna save you alot of lines
so?, instead of detecting movement input key presses you could just detect when the dash keybind is pressed
im trying to make like sidedahses
i mean like when the player presses the kybind S theygo backwards
well when the player presses s the move direction is completely different to when the player presses w
plus what if the player is pressing s and w at the same time
oh well, if you don't want to change your code its okay, here is an example, if you ever changed your mind
OnKeyPressed = function(Player)
local Character:Model = Player.Character
local Hum = Character.Humanoid
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(50000, 0, 50000)
if Character.Humanoid.MoveDirection ~= Vector3.new(0,0,0) then
BV.Velocity = Hum.MoveDirection * 150
else
BV.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 150
end
BV.Parent = Character.HumanoidRootPart
for i = 0, 5, 1 do
task.wait(0.1)
BV.Velocity = BV.Velocity * 0.7
end
BV:Destroy()
Hum.WalkSpeed = 20
end, ```
thats not the point 😭
just use movedirection to
is there anything i can refer to like if i move to the right and left other than my methods
o yea movedirection.X i forgot about that
O wait
the problem is
humanoidMoveDirection is in the world space
so that means if i move to the left side of the world space, accodring to logic i will dash fpward but then becuz this is in the worlds space right i will actually trigger the side dash animation
wait am i right?
o wait nvm i can use vectortoobjectspace lol
but i stll cannot use humanoid i will have to use hrp
Can you give me you dash script am making dragon ball game
would you pay for it
wyw
We don’t give anything free here
If you want a system, you gotta either work for it or pay for it
Nothing is free in this world
bro tryna copy Grow Plants 😭
No