Hello! I have attempted to create a kicking system using collision groups. However, the hitbox wont detect the ball even though they can collide in the collision group editor. Heres a screenshot of my collision editor:
and here’s a video:
robloxapp-20241005-1323283.wmv (1.2 MB)
and here’s my code:
local plr = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(inpt, gpe)
if inpt.UserInputType == Enum.UserInputType.MouseButton1 then
local hitbox = game.ReplicatedStorage.Hitbox:Clone()
hitbox.Parent = workspace
hitbox.Position = plr.Character.HumanoidRootPart.Position
hitbox.WeldConstraint.Part0 = plr.Character.HumanoidRootPart
local partsinbound = workspace:GetPartsInPart(hitbox)
game.Debris:AddItem(hitbox, 0.3)
for i,v: Part in pairs(partsinbound) do
print(v)
if v.Name == "Ball" then
game.ReplicatedStorage.Kickrem:FireServer(v)
repeat
task.wait()
until v:GetAttribute("Owner") == plr.Name
v:ApplyImpulse(Vector3.new(0,100,0))
print("yes")
end
end
end
end)
Thank you in advance!