hallo guys, making game like tsb and making hitbox, and found one problem
i wanna find value inside character that hitted and detect is value false or true, if value is false then no damage, but if value is true, hitbox does damage
idk how to do that plz help, here a script with my hitboxes
local module = require(game.ReplicatedStorage.MuchachoHitbox)
local right_event = script.Parent.m1_local.right_arm
local left_event = script.Parent.m1_local.left_arm
local slow_speed = 7
local wait_speed = 0.5
local damage_per_hit = 3
local hum = script.Parent:WaitForChild("Humanoid")
local right_arm = script.Parent:WaitForChild("Right Arm")
local left_arm = script.Parent:WaitForChild("Left Arm")
local char = script.Parent.Parent
right_event.OnServerEvent:Connect(function()
local hitbox_right = module.CreateHitbox()
hitbox_right.Size = right_arm.Size
hitbox_right.CFrame = right_arm
hitbox_right.Visualizer = true -- vizualize hitbox itself
local params = OverlapParams.new()
params.FilterDescendantsInstances = {script.Parent}
params.FilterType = Enum.RaycastFilterType.Exclude
hitbox_right.OverlapParams = params
hitbox_right.Touched:Connect(function(hit, hum)
hum:TakeDamage(damage_per_hit)
end)
hitbox_right:Start()
hum.WalkSpeed = slow_speed
wait(wait_speed)
hum.WalkSpeed = game.StarterPlayer.CharacterWalkSpeed
hitbox_right:Stop()
end)
left_event.OnServerEvent:Connect(function()
local hitbox_left = module.CreateHitbox()
hitbox_left.Size = left_arm.Size
hitbox_left.CFrame = left_arm
hitbox_left.Visualizer = true -- vizualize hitbox itself
local params = OverlapParams.new()
params.FilterDescendantsInstances = {script.Parent}
params.FilterType = Enum.RaycastFilterType.Exclude
hitbox_left.OverlapParams = params
hitbox_left.Touched:Connect(function(hit, hum)
hum:TakeDamage(damage_per_hit)
end)
hitbox_left:Start()
hum.WalkSpeed = slow_speed
wait(wait_speed)
hum.WalkSpeed = game.StarterPlayer.CharacterWalkSpeed
hitbox_left:Stop()
end)