I’m working on a game based on combat and kombat.
I’m thinking about an unusual problem right now, but I couldn’t solve it somehow.
The problem is with Block(f) in the game.
When you log into the game as a player, if you use the block(f) feature in the game normally, if you hold “f” without error, the player will block, that is, the defense, but if you want to use the block(f) feature again after dying once, if you do not hold down the “f” key when you press it. even the character remains in block(f) and cannot return to normal without dying.
local Values = require(game.ReplicatedStorage:WaitForChild("Combat"):WaitForChild("Values"))
script.Parent.OnServerEvent:Connect(function(plr,Action)
local Char = plr.Character
local Hum = Char:WaitForChild("Humanoid")
if Action == "Start" then
Values:CreateValue("BoolValue",Char,"Blocking",false,math.huge)
Values:CreateValue("BoolValue",Char,"PB",false,.1)
local BlockAnim = Hum:LoadAnimation(script:WaitForChild("BlockAnim"))
BlockAnim:Play()
end
if Action == "Stop" then
for i,v in pairs(Char:GetChildren()) do
if v.Name == "Blocking" then
v:Destroy()
end
end
local AnimTracks = Hum:GetPlayingAnimationTracks()
for i,v in pairs(AnimTracks) do
if v.Name == "BlockAnim" then
v:Stop()
end
end
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.