#Hitbox help
136 messages · Page 1 of 1 (latest)
make sure they have CanTouch on or whatever its called
it does
Hitbox Script ```lua local tool = script.Parent.Parent
local Hitbox = script.Hitbox
tool.Equipped:Connect(function()
while true do
Hitbox.Middle.Rotation = tool.Parent.HumanoidRootPart.Orientation
wait()
Hitbox.Middle.Position = tool.Parent.HumanoidRootPart.Position
end
end)
Part to touch script: ```lua local part = script.Parent
part.Touched:Connect(function(hit)
print(hit.Name)
end)```
Could it be because the parts are located inside of a tool?
They aren't located inside the workspace
They are in the tool the player holds
@forest zodiac
ok so first,u used while true do which is an uncool stuff since its rll buggy,id recommend using runservice for looping
second,can u tell me if u can see the hitbox is rll out the workspace?maybe ur while wait code causes it some glitch
and one more,if ur doing a rotation script thingy dont apply it on hitbox,cuz once again buggy,and if its not a rotating code only call the hitbox's reposition code out once pal
overall i cant see any other problems beside whilewait and ur rotating the hitbox
why would u want ur hitbox to rotate tho?
if u wanna make it like that,id recomment use another type of hitbox statement
like :GetPartsInPart()
The parts are welded
I'll send a video later to help explain
ok srr my mom called me
ok so,since ur making ur hitbox moving
it wouldnt work with touched
id recommend using :GetPartsInPart()
even tho it returns a table,but thers sometrick to do with it
simplest trick is for i,v in pair(game.workspace:GetChildren() do if v.Name = --the table u recived from GetPartsInPart-- then --do stuffs-- end)
u should go ahead and search it up,peope explains better than me
so in conclusion the solution is to use another hitbox method: :GetPartsInPart
Okey dokey
I'll try later
But the hit box is a model, with3 parts inside
The middle, which is welded to the hitboxL and hitboxR
The two hit ones have a offset to be In front of the play
Player
So u can't hit the ball when it's behind u
That's why I'm using a rotation script
And there's 2 because there is two different swings and depending on which hit box it hits u need to swing that why to return the ball
Way
The model is inside a script inside a folder inside a tool inside the play modrl
** You are now Level 12! **
welp,das a great idea for a game
an overaall,ur still rotating the hitbox
so the only way is that way i told u lol
Ok
Ty
np
Wait but the model is not a child of workspace it's a child of the script which I'd a child of a folder which is a child of a tool which is a child of the player model
Sry it's confusing
I wish I could send screen shot
Ok ty
does this work for models
and what would i do?
local getpartsinpart = model:GetPartsInPart
?
yea idk how to use this at all
where do i put it and how do i implment it and also what does it have to do with a DIFFERENT part not being able to touch it
flip it didnt record right
ill send vid tmr
Cause the hit box follows Me correctly
It's just a different doesn't register it hitting it
It registers the player touching it
But not the hitbox located inside the script inside the players tool
u gotta search it up bro
its rll complicated if u use it for hitbox,cuz as i said getpartsinpart only returns a table of parts that r in them.Just search on how to usr it for hirbox
@forest zodiac im going for a different aproch becuase i cant find any thing that explains it well so im doing this now: ```local tool = script.Parent.Parent
local Hitbox = script.Hitbox
tool.Equipped:Connect(function()
local playerName = tool.Parent.Name
local playerhitbox = Hitbox:Clone()
playerhitbox.Name = playerName.. "'s Hitbox"
playerhitbox.Parent = workspace
while true do
playerhitbox.Middle.Rotation = tool.Parent.HumanoidRootPart.Orientation
wait()
playerhitbox.Middle.Position = tool.Parent.HumanoidRootPart.Position
end
end)
tool.Unequipped:Connect(function()
local playerName = tool.Parent.Parent.Name
local playerhitbox = workspace:FindFirstChild(playerName .. "'s Hitbox")
playerhitbox:Destroy()
end)
but my original welds dont work so idk
wait i can use pivot...
nvm
i cant use that for rotation
@forest zodiac pls help
wait why dont u use tween💀
i told u while true do isnt effective
and u can do an unlimited spinning using tween by just 2 lines
it also doesnt lag ur game
thats smth,hope it would work for u
but if u want a full example of getpartsinpart
hol on
local p = ur_hitbox
for i,v in pairs(game.Workspace:GetPartsInPart(p)) do
if v.Parents:FindFirstChild("Humanoid") then
--do stuffs
end
wait what
can you change that so that the players hitbox is located inside the workspace with Playersname.."'s Hitbox"
ye alr
** You are now Level 7! **
put the script inside the character
inside what character?
ok
eh nvm
continue...
not that
put it in ur hitbox
srr i thought this is dmg hitbox
local p = script.Parent
for i,v in pairs(game.Workspace:GetPartsInPart(p)) do
if v.Parents:FindFirstChild("Humanoid") then
--do stuffs
end
welp gtg to school now cya
No
It's was 728pm for me
I'm not hitting a humanoid
Ohhh
Nvm
Yea it doesn't work
ah s-
k can u tell me any specific thing that only ur ball has
or the
thing to swing that ball
my vocabulary is dum af
ok so maybe change ur ball name to "TennisBall"
and use this
local p = script.Parent
for i,v in pairs(game.Workspace:GetPartsInPart(p)) do
if v.Name == "TennisBall" then
--do stuffs
end
huh wdym?
That's what it says
In output
I think because the script is inside a model
Which holds the parts
welp i didnt used that much
ig u should go check on the internet
but for now ill try to help u
hol on,might take awhile
any ideas yet
what line did the error occured?
Get parts in part I think
The script.parent is a model
Does that have anything to do
can u tell me the exact line?
** You are now Level 8! **