How would I add CAS (ContextActionService) to this blocking script for my mobile fighters?
Not sure how I would add it, I’ve tried but I’m stuck at a roadblock.
I looked around on the devforum, other websites, and the create.roblox.com website and I still cannot figure it out.
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local blockingAnim = script:WaitForChild("BlockingAnim")
local CD = 0.05
local debounce = false
local BlockingRemote = game.ReplicatedStorage.BlockRemote.Blocking
local RemoveBlocking = game.ReplicatedStorage.BlockRemote.RemoveBlocking
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local gaurdingAnimation = hum:LoadAnimation(blockingAnim)
uis.InputBegan:Connect(function(input,Typing)
if not Typing then
if input.KeyCode == Enum.KeyCode.F and debounce == false then
if char:FindFirstChild("BlockBreak") == nil and char:FindFirstChild("Stun") == nil and char:FindFirstChild("eStun") == nil then
debounce = true
BlockingRemote:FireServer()
game.TweenService:Create(workspace.CurrentCamera,TweenInfo.new(.3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{FieldOfView = 65}):Play()
hum.WalkSpeed = 6
gaurdingAnimation:Play()
wait(CD)
debounce = false
end
end
end
end)
uis.InputEnded:Connect(function(input,Typing)
if input.KeyCode == Enum.KeyCode.F then
RemoveBlocking:FireServer()
game.TweenService:Create(workspace.CurrentCamera,TweenInfo.new(.3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{FieldOfView = 70}):Play()
gaurdingAnimation:Stop()
hum.WalkSpeed = 8
end
end)
RemoveBlocking.OnClientEvent:Connect(function()
RemoveBlocking:FireServer()
game.TweenService:Create(workspace.CurrentCamera,TweenInfo.new(.3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{FieldOfView = 70}):Play()
gaurdingAnimation:Stop()
hum.WalkSpeed = 8
end)