so i hava a combat block system
i wan’t it so that if you punch someone and he’s blocking(attribute) then it would return
but the issue is that the attribute replication between client to server to client is not working
block client:
while true do
task.wait(0.1)
-- if not attacking and not stunned then
if pressingF then
blockAnimationTrack:Play()
setAttribute:FireServer(player, character, "block")
else
blockAnimationTrack:Stop()
setAttribute:FireServer(player, character, "unblock")
end
end
setattributes server script(the command doesn’t work):
SetAttributeRemote.OnServerEvent:Connect(function(character, command)
print(character) -- prints the character
if command == "block" then -- doesn't work for some reason
print("setting attribute for this character to blocking true")
character:SetAttribute("Blocking", true)
character:GetAttribute("Blocking", true)
elseif command == "unblock" then
print("setting attribute for this character to blocking false")
character:SetAttribute("Blocking", false)
end
end)
combat client
enemyCharacter:GetAttributeChangedSignal("Blocking"):Connect(function()
if enemyCharacter:GetAttribute("Blocking", true) then
print("hello attribute blocking...")
if not (dotProduct >= 0.5) then -- behind or sideways
print("behind player or sideways")
elseif dotProduct >= 0.5 then -- if in the front of the player
print("in front and hes blocking")
-- play block sound
return
end
else
print(enemyCharacter:GetAttribute("Blocking"))
end
end)