As you can tell from the title, my code has problems with invoking and such. The Invoking function, as portrayed below, seems to not be called correctly which might be the problem. However, I’m unsure what’s wrong with the code itself. Referencing the developer hub, errors still occur even when everything seems to be correct. If you have any idea why this isn’t working, please don’t hesitate to respond. Thanks in advance!
Simplified Version Of My Code:
tool.Equipped:Connect(function()
tool.Blade.Touched:Connect(function(hit)
print("sending invoke...")
local hitPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)
local isBlocking = hitPlayer.Remotes.getBlockingState:Invoke()
print("recieved: "..isBlocking)
end)
Player.Remotes.getBlockingState.OnInvoke = function()
print("Blocking State Invoke!")
local isBlocking = false
for i,v in pairs(Humanoid:GetPlayingAnimationTracks())do
if v == BlockingTrack then
isBlocking = true
end
end
print("returning: "..isBlocking)
return isBlocking
end
end)
Output:
sending invoke...
sending invoke...
sending invoke...