I’m trying to create a hitbox on character’s table then use an bindable function to get that table accorss servers but it errors.
local Touched = RisytalEngine:ReturnF((...), "ev").GetHB:Invoke("RAH")
Touched.DetectionMode = 2
task.wait(0.7)
Touched:HitStart()
---
function RA(Part, Params)
local Values = {}
for _,v in game:GetService("ServerStorage").__CORE.RisytalStuff.Rightarm:GetChildren() do
table.insert(Values, v.Position)
end
local T = Hitbox.new(Part)
T.RaycastParams = Params
T:SetPoints(Part, Values)
return T
end
local PHData = {
["RLH"] = RisytalEngine:ReturnHit(Character["Right Leg"], Parms),
["RAH"] = RA(Character["Right Arm"], Parms)
}
EventsFolder.GetHB.OnInvoke = function(Hit)
return PHData[Hit]
end
The error: attempt to call missing method 'HitStart' of table
No offense, but this code is borderline unreadable. Abbreviating things requires context, and that’s context which we do not have. Also, this appears to use some kind of framework that you don’t mention?
It exists when I start the hitbox outside a dictionary. Hold @Pokemoncraft5290 I’m using Raycast Hitbox 4.01: For all your melee needs! to create and store hitboxes in a table, since I had no other ways to store them, then I figured I’ll use a bindable function to get the table from across every script. But that apparently breaks the whole framework. Since this is the normal to create hitboxes.
local newHit = HitboxManager.new(Tool.Handle)
newHit.RaycastParams = Params
newHit.OnHit:Connect(function(Hit, VictimHumanoid:Humanoid?)
end)
newHit:HitStart() -- Start it
Creating a new hitbox outside a dictionary seems to work but I wanna store them in a table to easier access!
Oh ryt I see the issue now, HitStart is inside the metatable of the original module, however bindable functions has this limitation where metatables are lost during transfer
Actually module scripts ought to work in this scenario. Your best bet is to create a module named Hiitbox and add utility methods called :AddHitbox:GetHitbox and so on. Then from your main scripts, you would require this Hitbox module and instead of:
local Touched = RisytalEngine:ReturnF((...), "ev").GetHB:Invoke("RAH")
you would do:
local Hitbox = require(ReplicatedStorage.Hitbox)
local Touched = Hitbox:GetHitbox("RAH")
Since module communication has no limitations like BindableFunctions, you would be able to call all the methods of the hotbox including HitStart
The issue is, like I said, I did the same with modules, but classes become nil, Since I store the hitboxes in a dictionary with the player name as an identifier.
I figured I’ll use this in both character script and main game script.
function CheckHitbox(Object, Character)
if RaycastHitbox:GetHitbox(Object) == nil then
print("is nil")
local Parms:RaycastParams? = RaycastParams.new()
Parms.FilterDescendantsInstances = {Character, workspace.__SPAWNEDSTUFF, workspace.Filter}
Parms.FilterType = Enum.RaycastFilterType.Exclude
return RisytalEngine:ReturnHit(Object, Parms)
end
print("its not nil")
return RaycastHitbox:GetHitbox(Object)
end