You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to achieve a blocking system where I hold F with my sword to block. -
What is the issue? Include screenshots / videos if possible!
Other people can make me unblock. Fixed the thing where clicking made me unblock.
local script
k = ""
bd = false
uis.InputBegan:Connect(function(input,typing)
if typing == true then return end
if input.KeyCode == Enum.KeyCode.F then
bd = true
k = 'F'
game.ReplicatedStorage.Sword:FireServer('Blocking')
while bd == true do
wait()
end
game.ReplicatedStorage.Sword:FireServer('Release')
end
end)
uis.InputEnded:Connect(function(input,typing)
if typing == true then return end
if input.KeyCode == Enum.KeyCode.F and k == 'F' then
bd = false
end
end)
script
bd = false
game.ReplicatedStorage.Sword.OnServerEvent:Connect(function(plr,act)
local enabled = true
local c = plr.Character
if act == 'Release' then
bd = false
end
lseif act == 'Blocking' and c:FindFirstChild('Sword') ~= nil and enabled == true and c:FindFirstChild('Stunned') == nil then
enabled = false
bd = true
local b = Instance.new("BoolValue",c)
b.Name = 'PerfectBlocking'
local anim = Instance.new("Animation")
anim.AnimationId = 'rbxassetid://5837760327'
local aaa = c.Humanoid:LoadAnimation(anim)
aaa:Play()
c.Humanoid.JumpPower = 0
c.Humanoid.WalkSpeed = 2.5
spawn(function()
wait(.2)
b.Name = 'Blocking'
wait(.8)
enabled = true
end)
while bd == true do
wait()
end
game.Debris:AddItem(b,0)
c.Humanoid.JumpPower = 50
c.Humanoid.WalkSpeed = 16
aaa:Stop()
end)
I’d really appreciate it if anybody could help me, thanks.