Hopefully this is the last problem for the night! This one specifically has been quite confusing for me.
I am making a client sided hitbox (have made a few posts today regarding it) and everything is working fine except for this one odd thing I can’t quite figure out. I have a marker in my animation set to spawn the hitbox which should just run that block but for some reason the debris service runs but then the part gets duplicated on top of itself when fired again? Deleting the GetPropertyChangedSignal function and replacing it with a wait statements works just fine but there has to be a better way to fix it rather than just doing that.
I don’t know what I’m not seeing in this and I’ve been stumped for a little bit because of it.
(See workspace to understand what I’m getting at)
It’s probably something small and I know that just doing task.wait() is a bandaid fix. I really want to be able to implement animation markers into making my hitboxes.
Local Script:
UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then
return
end
if input.KeyCode == Enum.KeyCode.Q then
gravity:Play()
gravity:GetMarkerReachedSignal("GravEffect"):Connect(function()
local hrp = pChar:FindFirstChild("HumanoidRootPart")
local hitbox = Instance.new("Part")
local pos = hrp.Position
local hitCharacters = {}
local parameters = OverlapParams.new()
hitbox.Shape = Enum.PartType.Ball
hitbox.Size = Vector3.new(10, 10, 10)
hitbox.CanCollide = false
hitbox.CanTouch = false
hitbox.CanQuery = false
hitbox.Anchored = true
hitbox.Transparency = 0.5
local cf = hrp.CFrame
local size = hitbox.Size
parameters.FilterDescendantsInstances = {pChar}
local hitboxPart = workspace:GetPartBoundsInBox(cf, size, parameters)
local vTable = {}
for _, hitPart in pairs(hitboxPart) do
local vHum = hitPart.Parent:FindFirstChild("Humanoid")
if vHum and not table.find(vTable, hitPart.Parent) then
table.insert(vTable, hitPart.Parent)
end
end
hitbox.Position = pos
hitbox.Parent = workspace
abilityRemote:FireServer(vTable, 3, 6, 75) --I would add a cooldown, magnitude and angle value in here
game.Debris:AddItem(hitbox, 0.1)
end)
end
end)