#My hitbox only detects one person at a time

1 messages · Page 1 of 1 (latest)

little ermine
#

function hitbox()
local hitbox = game.ReplicatedStorage.katanaHitBox:Clone()
hitbox.Parent = workspace
hitbox.CanCollide = false
hitbox.Massless = true
hitbox.Anchored = false
hitbox.CFrame = blade.CFrame

local weld = Instance.new("WeldConstraint")
weld.Parent = hitbox
weld.Part0 = hitbox
weld.Part1 = blade

game.Debris:AddItem(hitbox, 0.7)



--fire to server!
local hits = {}
hitbox.Touched:Connect(function(hit)

    table.insert(hits, hit)
    game.ReplicatedStorage.swordEvent:FireServer(hit)

end)

end

edgy vault
#

id recommend you research about other spatial query methods to see which one fits your game most

torpid comet
edgy vault
#

also the problem isnt about table its about the hitbox not able to detect other objects

torpid comet
#

yea i just realized its .touched

edgy vault
#

ye

little ermine
torpid comet
#

like forsaken

#

but its more complicated

#

there are tutorials on it

little ermine
#

bro

#

its so complicated

#

ive been trying to learn that

#

but idk how to stat

#

start

torpid comet
#

i can give you an example if you want

little ermine
#

alr can you plz give an example of a hitbox that is in replaiced storage that is cloned?

#

I have made the sword system, hitbox already

#

Here

#

how would i implement getparts inpart instead of touched

#

I'm at a fresh start rn

#

my code is renewed

#

@torpid comet

torpid comet
#

@little ermine (you import it by right clicking workspace and then clicking add, add by file)

little ermine
#

@torpid comet ty

#

ill try to understnad it

#

By the way

#

It keeps gi ving me this error

#

How do i get the correct directory

torpid comet
#

Make sure you use findfirstchild or just waitforchild

#

If it doesnt work than you did a step wrong

little ermine
#

@torpid comet

#

findfirst and waitfor doesntwork

torpid comet
# little ermine

You are choosing the tool object. You need to choose the handle

#

The tool object isnt where the tool is located inside the game

little ermine
#

wdym

#

where

torpid comet
#

Do blade.handle

#

Or wait

little ermine
#

The motor 6d is fine now, but the animation doesn't play the joint

#

local motorEvent = game.ReplicatedStorage.MOTOR6DEVENT

motorEvent.OnServerEvent:Connect(function(player)
player.Character:WaitForChild("Right Arm"):WaitForChild("RightGrip"):Destroy()
local character = player.Character
local motor = Instance.new("Motor6D")
motor.Name = "Right"
motor.Parent = character:WaitForChild("Right Arm")
motor.Part0 = character:WaitForChild("Right Arm")
motor.Part1 = player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("Blade")
motor.C1 = CFrame.new(-0.035, -2.535, 0.61)*CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))

end)

torpid comet
#

Do this

little ermine
#

mb

#

bro how

#

there

#

mb

#

thats the local

#
local daggerEvent = game.ReplicatedStorage["MOTOR6d EVENTS"].DaggerEvent

daggerEvent.OnServerEvent:Connect(function(player)
    player.Character:WaitForChild("Right Arm"):WaitForChild("RightGrip"):Destroy()
    local character = player.Character
    local motor = Instance.new("Motor6D")
    motor.Name = "Right"
    motor.Parent = character:WaitForChild("Right Arm")
    motor.Part0 = character:WaitForChild("Right Arm")
    motor.Part1 = player.Character:FindFirstChildOfClass("Tool"):FindFirstChild("Blade")    
    motor.C1 = CFrame.new(-0.035, -2.535, 0.61)*CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
    
end)