What do you want to achieve? I got a Hitbox, and i want it to detect touch.
What is the issue? It used to work fine, but it stopped working for some reason
What solutions have you tried so far? i’ve tried debugging to see what the hell is going on to no avail
Not sure if this is the right place to get help with this module script. The original topic is dead so i can’t ask for help there.
-- This Local script creates the Hitboxes
local RaycastHitbox = require(game:GetService("ReplicatedStorage").Modules.RaycastHitboxV4)
local Table = {"RightHand","LeftHand","RightFoot","LeftFoot"}
local Character = script.Parent
local Parameters = RaycastParams.new()
Parameters.FilterDescendantsInstances = {Character}
Parameters.FilterType = Enum.RaycastFilterType.Exclude
-- Makes a Hitbox for each Bodypart in Table
for i, PartName in ipairs(Table) do
local BodyPart = Character:WaitForChild(PartName)
if BodyPart then
local NewHitbox = RaycastHitbox.new(BodyPart)
NewHitbox.RaycastParams = Parameters
end
end
This one is supposed to Detect touch, and it worked until something i did in some script somewhere made it stop working.
local RayHitBox = require(game.ReplicatedStorage.Modules.RaycastHitboxV4)
local RemoteEvent = game:GetService("ReplicatedStorage").Remotes.RayHitboxClient
RemoteEvent.OnClientEvent:Connect(function(Part, Attack)
-- Gets Hitboxes made in last script
local Hitbox = RayHitBox.new(Part)
print(Hitbox, Part, Part.Parent) -- Prints out the Hitbox, BodyPart and Character as it should
Hitbox.OnHit:Connect(function(Hit, Human)
print("This message is never printed out...")
end)
Hitbox:HitStart(1)
end)
both of the scripts are local, i need to do it in local scripts, else the hitboxes will lag behind the player. Also this script used to work before, and it was on local back then.
Do you have any attachments in the body parts named “DmgPoint”?
You need to have attachments in the body parts with the name “DmgPoint” for there to even be any type of hitbox to toggle on or off.
If you need to make a hitbox through RaycastHitboxV4, they have a function for it called :SetPoints(). You probably need to use this to make the hitbox for the body parts.
-- This Local script creates the Hitboxes
local RaycastHitbox = require(game:GetService("ReplicatedStorage").Modules.RaycastHitboxV4)
local Table = {"RightHand","LeftHand","RightFoot","LeftFoot"}
local Character = script.Parent
local Parameters = RaycastParams.new()
Parameters.FilterDescendantsInstances = {Character}
Parameters.FilterType = Enum.RaycastFilterType.Exclude
-- Makes a Hitbox for each Bodypart in Table
for i, PartName in ipairs(Table) do
local BodyPart = Character:WaitForChild(PartName)
if BodyPart then
local NewHitbox = RaycastHitbox.new(BodyPart)
NewHitbox.RaycastParams = Parameters
end
end
I fixed this by making it run in the second script when the Hitbox hasn’t been created yet
local ConfigHitbox = function(Part, Character)
local Hitbox = RayHitBox:GetHitbox(Part)
if Hitbox then
return Hitbox
else
Hitbox = RayHitBox.new(Part)
Hitbox.Visualizer = true
local Parameters = RaycastParams.new()
Parameters.FilterDescendantsInstances = {Character}
Parameters.FilterType = Enum.RaycastFilterType.Exclude
Hitbox.RaycastParams = Parameters
return Hitbox
end
end
RemoteEvent.OnClientEvent:Connect(function(Part,Attack)
local Hitbox = ConfigHitbox(Part, Character)
end)