I currently attempting to transform the player’s character’s hitbox into a box. I don’t want to use a hacky method that might not work in the future.
Currently I have tried messing with collision groups and then welding a hitbox, but that hasn’t worked: https://gyazo.com/74dda4f3281c92da4795f73ec6c41e67
Place: Failed Hitbox.rbxl (15.6 KB)
Current Code:
local ps = game:GetService("PhysicsService")
ps:CreateCollisionGroup("No")--Don't collide
ps:CollisionGroupSetCollidable("No","No",false)--No collision with self
ps:CollisionGroupSetCollidable("No","Default",false)--Or other parts
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)--Idealy, this would be a starterCharacter script, just trying to get it to work first
wait(1)--Testing purposes
local root = c:WaitForChild("UpperTorso")
for a,b in pairs(c:GetChildren()) do
if b:FindFirstChild("Handle") then
ps:SetPartCollisionGroup(b.Handle,"No")
elseif b:IsA("BasePart") then
ps:SetPartCollisionGroup(b,"No")
end
end
local new = script.hb:Clone()
new.Name = "Torso"
new.CFrame = root.CFrame
local w = Instance.new("Weld")
w.C0 = root.CFrame:inverse()
w.Part0 = new
w.C1 = new.CFrame:inverse()
w.Part1 = root
w.Parent = new
new.Parent = root.Parent
end)
end)
Note: I have seen other posts like mine, but they don’t seem to work for my use case. Sorry if I’m just being dumb.
Thanks in advance.