I am trying to use the FastCast Redux script from Eti, and it working great. Problem is, I have no idea how to pass on more info to the active cast.
whatever.OnServerEvent:connect(function(gunstuff)
local Target = GunCFrame:ToWorldSpace(CFrameOffset)
local Direction = (Target.Position-GunFirePoint).Unit
CastParams.FilterDescendantsInstances={gun,BulletsFolder}
CastBehavior.Acceleration = Vector3.new(0,-workspace.Gravity-GunProperties[1],0)
print("Firing bullet")
Caster:Fire(GunFirePoint,Direction,GunProperties[4],CastBehavior)
end
This script receives the call to fire a bullet and works great. I removed a good amount of code to make it simple and readable.
caster.OnRayHit:connect(function(ActiveCast,result,velocity,bullet)
local character=result.Instance
if character and character.Parent.Parent.Name ~=tostring(game:GetService("Players"):GetPlayerFromCharacter(Player).UserId) and character.Parent.Name ~=tostring(game:GetService("Players"):GetPlayerFromCharacter(Player).Name) then
if Bomb then
else
end
end)
Now, my question is, how do I get a table passed from OnServerEvent to OnRayHit?
In the doc/api of FastCast Redux, it says the ActiveCast object is supposed to pass UserData as the last parameter. Perfect. SO WHERE DO I PUT THAT? how do I access Active Cast before OnRayHit is called? I need to send info WHILE activating the Fire function, but I dont see a spot to insert data.
Here is the documentation
You take Caster, fire a function called Fire, and make an ActiveCast as a result. But, while a ActiveCast exist, it’ll call the OnRayHit immediately if an object is detected on the ray. So, its impossible to access ActiveCast.UserData to put your custom data in before the OnRayHit is called.
If anyone who messes with FastCast Redux knows what I am supposed to do, I would greatly appreciate pointing me in the right direction.