local UserInputService = game:GetService("UserInputService")
local ReplecatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Events = ReplecatedStorage:WaitForChild("Events")
local Character = script.Parent.Parent
local IsBlocking = false
UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then
return
end
if Input.UserInputType == Enum.UserInputType.MouseButton1 and not IsBlocking then
Events.ClickAttack:FireServer()
end
if Input.KeyCode == Enum.KeyCode.F then
IsBlocking = true
Events.Block:FireServer(true)
Character.Humanoid.WalkSpeed = 8
end
end)
UserInputService.InputEnded:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then
return
end
if Input.KeyCode == Enum.KeyCode.F then
IsBlocking = false
Events.Block:FireServer(false)
Character.Humanoid.Walkspeed = 16
end
end)