so i have m1 and blocking system and when you block you get a bool value for .7 seconds and if the parry value is true it should make you get stunned, but the problem is idk how to make the script work like that. my errors say “parry isnt a valid member of dummy” and the problem with that is i only want the dummy/player to have the parry value for .7 seconds to prevent exploiters from auto parry
m2 localscript
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local M2Anim = script:WaitForChild("M2Anim")
local CD = 2.5
local debounce = false
local M2Remote = game.ReplicatedStorage.M2Remote.M2Fire
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local gaurdingAnimation = hum:LoadAnimation(M2Anim)
local uis = game:GetService("UserInputService")
local UserInputService = game:GetService("UserInputService")
while true do
task.wait()
uis.InputBegan:Connect(function(input, Typing)
if not Typing then
if input.UserInputType == Enum.UserInputType.MouseButton2 and uis.MouseBehavior == Enum.MouseBehavior.LockCenter == true and debounce == false then
if char:FindFirstChild("Stun") == nil and char:FindFirstChild("eStun") == nil then
debounce = true
M2Remote:FireServer()
local sfx = workspace.Audio.AbilityAudio.Audio.M2:Clone()
sfx.Parent = player.Character.Torso
sfx:Play()
game.Debris:AddItem(sfx,1)
hum.WalkSpeed = 3.5
gaurdingAnimation:Play()
delay(.6,function()
hum.WalkSpeed = 16
end)
wait(CD)
debounce = false
end
end
end
end)
end
m2 serverscript
local m2Event = game.ReplicatedStorage.M2Remote.M2Fire
m2Event.OnServerEvent:Connect(function(plr)
local char = plr.Character
local hb = char:FindFirstChild("Torso")
local root = char:FindFirstChild("HumanoidRootPart")
local ws = game.Workspace.PlayersAndMobs
for i,v in pairs(ws:GetChildren()) do -- look through all the workspace
if v:FindFirstChild("Humanoid") and v:FindFirstChild("Head") and v.Name ~= plr.Name and char:FindFirstChild("Blocking") == nil and v.Parry.Value == false then
if v:FindFirstChild("Parry").Value == true then
local hum = char:WaitForChild("Humanoid")
local dist = (v.Head.Position - hb.Position).magnitude --find the distance between us and the ting
if dist < 5 then -- if its less than 5studs then
v.Humanoid:TakeDamage(9) -- take 9 damage
script.Parent.HitSound:Play()
local fxcln = script.fx:Clone()
fxcln.Parent = v.Head.Parent.HumanoidRootPart
fxcln.CFrame = v.Head.Parent.HumanoidRootPart.CFrame
game.Debris:AddItem(fxcln,.3)
local bv = Instance.new("BodyVelocity",v.HumanoidRootPart) --make the knockback
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) -- maximum force
bv.Velocity = root.CFrame.lookVector * 45 + Vector3.new(0,7,10) -- the force
game.Debris:AddItem(bv,.3) --it will last 0.3 seconds
if v.Parry.Value == true then
local parrysfx = workspace.Audio.AbilityAudio.Audio.Parry:Clone()
parrysfx.Parent = root
parrysfx:Play()
hum.WalkSpeed = 3
wait(2.5)
parrysfx:Destroy()
hum.WalkSpeed = 16
end
end
end
end
end
end)
and the blocking/parry localscript is
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local blockingAnim = script:WaitForChild("BlockingAnim")
local CD = 1
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 = 7
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 = 6
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 = 16
end)
blocking serverscript is
local Block = game.ReplicatedStorage.BlockRemote.Blocking
local Remove = game.ReplicatedStorage.BlockRemote.RemoveBlocking
Block.OnServerEvent:Connect(function(plr)
local char = plr.Character
local BlockingValue = Instance.new("BoolValue",char)
BlockingValue.Name = "Blocking"
local ParryValue = Instance.new("BoolValue",char)
ParryValue.Name = "Parry"
ParryValue.Value = true
delay(.7,function()
ParryValue.Value = false
end)
end)
Remove.OnServerEvent:Connect(function(plr)
for i,v in pairs(plr.Character:GetChildren())do
if v.Name == "Blocking" then
v:Destroy()
end
end
end)
so the m2 dosent run because parry isnt a value all the time im pretty sure. how can i fix this?