The forcefield doesn't stop damage taken even when ``force.Visible = true
local function spawnShield()
local playerCFrame = nil
shield = replicatedStorage:WaitForChild('Shield'):Clone()
shield.Parent = game.Workspace
force = Instance.new('ForceField')
force.Visible = false
force.Parent = player.Character.Humanoid.Parent
runService:BindToRenderStep('shield',1,function() -- fake shield that follows the player
playerCFrame = player.Character.HumanoidRootPart.CFrame
shield.CFrame = playerCFrame * CFrame.Angles(0,0,math.rad(90))
end)
end
local function destroyShield()
runService:UnbindFromRenderStep('shield')
shield:Destroy()
force:Destroy()
end
uis.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
debounce,hitBool = false,false
playslash = player.Character.Humanoid:LoadAnimation(blockAnim)
playslash:Play()
spawnShield()
end
end)
uis.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
debounce = true
intValue.Value = 0
playslash:Stop()
if shield ~= nil then
destroyShield()
end
end
end)
