i have problems with thinking of ways to only show cooldown when you actually use double jump, because the cooldown keeps on starting when space is pressed, so i tried to turn on the activate when let go, but i can't think of a way to only process let go when you meet the criteria of using your double jump so that you can actually get cooldowned properly. right now my problem is that it doesn't return the cooldown thing and it doesn't show up, secondly the animation itself isn't playing.
#how do i fix this double jump script that's also a module
1 messages · Page 1 of 1 (latest)
-- [CLIENT] --> Shared to all clients
--> Services
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
--> References
local LocalPlayer = Players.LocalPlayer
--> Configuration
local GlobalKeybinds = {
MakeInputButton = true, -- Input button shown for the player using CustomCAS module
CustomText = "Jump", -- Set to nil to disable: sets custom text for input button
Priority = 1, -- Order of the button
Icon = nil, -- Set to an image ID if you wan't the input button to use an icon instead of name
MakeClickSound = false, -- Whether activating the keybind itself make a click sound
CanPress = false, -- Can press the input button
ActivateCooldownWhenLetGo = true, -- If set to false, cooldown will start when the player activates OnPressed.
Cooldown = 1, -- Cooldown, in seconds, until the user can activate again
Key = "Space", -- Valid keybinds which will activate this function, set to nil to only use input button
}
GlobalKeybinds.Disabled = false -- Left here for developers to have an example; set to false or remove this line for the keybind to work.
local jumpUsage = 1
function GlobalKeybinds:RequestValidation(Player)
if UIS:IsKeyDown(Enum.KeyCode.Space) and jumpUsage == 1 then
return true
else
return false
end
end
function GlobalKeybinds:OnActivated(Player)
local Char = Player.Character
local Hum = Char.Humanoid::Humanoid?
local AnimCore = Hum.Animator::Animator?
if Hum:GetState() == Enum.HumanoidStateType.Freefall and jumpUsage == 1 then
jumpUsage = 0
local anim = AnimCore:LoadAnimation(script.flip)
anim:Play()
Hum:ChangeState(Enum.HumanoidStateType.Jumping, true)
end
repeat task.wait() until Hum:GetState() == Enum.HumanoidStateType.Landed
if Hum:GetState() == Enum.HumanoidStateType.Landed then
jumpUsage = 1
end
end
function GlobalKeybinds:OnLetGo(Player)
if jumpUsage == 0 then
return true
else
return false
end
end
return GlobalKeybinds
this is one whole script, discord just limits me from sending all at once
it does let me jump tho
maybe using onletgo is impossible
i'll try to do the thing on request validation
here's a successful reference for my other child (dash module)
-- [CLIENT] --> Shared to all clients
--> Services
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
--> References
local LocalPlayer = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SFX = require(ReplicatedStorage.Modules.Shared.SFX)
--> Configuration
local GlobalKeybinds = {
MakeInputButton = true, -- Input button shown for the player using CustomCAS module
CustomText = "Q", -- Set to nil to disable: sets custom text for input button
Priority = 2, -- Order of the button
Icon = nil, -- Set to an image ID if you wan't the input button to use an icon instead of name
MakeClickSound = false, -- Whether activating the keybind itself make a click sound
CanPress = true, -- Can press the input button
ActivateCooldownWhenLetGo = false, -- If set to false, cooldown will start when the player activates OnPressed.
Cooldown = 1, -- Cooldown, in seconds, until the user can activate again
Key = "Q", -- Valid keybinds which will activate this function, set to nil to only use input button
}
GlobalKeybinds.Disabled = false -- Left here for developers to have an example; set to false or remove this line for the keybind to work.
function GlobalKeybinds:RequestValidation(Player)
if UIS:IsKeyDown(Enum.KeyCode.W) or UIS:IsKeyDown(Enum.KeyCode.A) or UIS:IsKeyDown(Enum.KeyCode.S) or UIS:IsKeyDown(Enum.KeyCode.D) then
return true
else
return false
end
end
function GlobalKeybinds:OnActivated(Player)
local Char = Player.Character
local Tor = Char.Torso::BasePart?
local Hum = Char.Humanoid::Humanoid?
local AnimCore = Hum.Animator::Animator?
if UIS:IsKeyDown(Enum.KeyCode.W) then
local anim = AnimCore:LoadAnimation(script.DashW)
anim:Play()
SFX:Play3D(2769872789, Tor.Position, {MaxDistance = 100, MinDistance = 20})
local Bv = Instance.new("BodyVelocity", Tor)
Bv.P = 1250
Bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Bv.Velocity = Tor.CFrame.LookVector*100
game.Debris:AddItem(Bv,0.1)
elseif UIS:IsKeyDown(Enum.KeyCode.A) then
local anim = AnimCore:LoadAnimation(script.DashA)
anim:Play()
SFX:Play3D(2769872789, Tor.Position, {MaxDistance = 100, MinDistance = 20})
local Bv = Instance.new("BodyVelocity", Tor)
Bv.P = 1250
Bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Bv.Velocity = Tor.CFrame.RightVector*-100
game.Debris:AddItem(Bv,0.1)
elseif UIS:IsKeyDown(Enum.KeyCode.D) then
local anim = AnimCore:LoadAnimation(script.DashD)
anim:Play()
SFX:Play3D(2769872789, Tor.Position, {MaxDistance = 100, MinDistance = 20})
local Bv = Instance.new("BodyVelocity", Tor)
Bv.P = 1250
Bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Bv.Velocity = Tor.CFrame.RightVector*100
game.Debris:AddItem(Bv,0.1)
elseif UIS:IsKeyDown(Enum.KeyCode.S) then
local anim = AnimCore:LoadAnimation(script.DashS)
anim:Play()
SFX:Play3D(2769872789, Tor.Position, {MaxDistance = 100, MinDistance = 20})
local Bv = Instance.new("BodyVelocity", Tor)
Bv.P = 1250
Bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Bv.Velocity = Tor.CFrame.LookVector*-100
game.Debris:AddItem(Bv,0.1)
end
end
function GlobalKeybinds:OnLetGo(Player)
print("Client: yeah fuck you wohoo")
end
return GlobalKeybinds