Hi
I have a remote that the client fires to tell the server it wants to fire a bullet. The server then handles the damage to other players of multiple guns in a central script. I’m stuck however at how I can get the player that fired the bullet from the serverscript.
I’m not supposed to add the RayHit connection under the OnServerEvent connection, so is there a way to pass information to Caster:Fire() that can be retrieved by Caster.RayHit()?
You can (and should) use a second caster if its behavior is different than the primary weapon.
I think you’re approaching the problem incorrectly. Your message is a bit confusing though, I’m not sure of your intent. OnServerEvent should only be doing things like firing the caster. The events should be connected to externally.
If you want to track which player fired what bullet, use ActiveCast.UserData:
remote.OnServerEvent:Connect(function (player, ...)
local cast = caster:Fire(...)
cast.UserData.Creator = player
end)
When I said “be specific”, I meant to run through exactly what you’re doing.
When you tell me “(thing) is broken”, that’s basically like going to a restaurant and telling the waiter “I want food”. Yes, I know that. You have to actually give me information about what it is that you’re doing, otherwise everything you’ve told me ends up being worse than useless.
What are you trying to do? What does the code look like? How are you using the function? Be specific and complete.
So I’m using the pierce function to pierce through humanoids that are already killed (so dead bodies can’t block bullets). Basically, if the health <= 0 then it returns true and pierces the body.
The problem is I keep getting this warning every time the bullet hits a “dead body” part.
WARNING: Exceeded maximum pierce test budget for a single ray segment (attempted to test the same segment 100 times!)"
Do you know why this might be and/or how to stop it? I’m assuming it keeps hitting the same part but wouldn’t the ray already be incremented forward by one increment already?
For reference, I don’t have a OnRayPierced function attached. If it does pierce, it doesn’t do any modifications such as bouncing. Also, the raycast filter is on a Whitelist.
I take it you’re using the part cache module that comes with it right? I also take it you’re using trails for the bullet to make a bullet tracers? So basically, what you could do is disable the trail when it’s in the cache. When you fire a bullet, wait until the bullet actually comes down to the gun, and then enable the trail. So the trail doesn’t “come from the sky”.
local FastCast = require(script.FastCastRedux)
FastCast.VisualizeCasts = true
local caster = FastCast.new()
local origin = workspace.TEST.FirePoint.WorldPosition
local direction = workspace.TEST.Orientation
caster:Fire(origin, direction, 10)
I’ve tried different values and nothing seems to work. The only thing that I know is that the VisualizeCasts’ CFrame is NAN (huge number). This script is under workspace. Everything looks like it’s working but it doesn’t visualize it correctly.
Am I missing something from the documentation?
EDIT : I figured out that the direction Vector3 was not giving the correct values. To go around this I made an attachment point and made it face the direction that I wanted to shoot using the WorldAxis to get the Vector3. Is there a way to get the Vector3 of a part the gives the same Vector3 as the attachment?
EDIT 2 : I found out that I need the LookVector. This took way longer then it should have.
soo piercing is confusing for me. Not much documentation on the github for it, so I’m kinda at a loss of how to implement it. Whenever the pierce function fires, I check for a humanoid. If it detects a humanoid I call my damage function to calculate damage and do a bunch of checks. mind you my damage function DOES NOT yield whatsoever. But whenever I try calling it from the pierce function, the module returns an error about taking too long to complete. I’m probably over looking something, but at the moment I don’t know where to look for answers besides here. Originally, I thought it was my damage function, but after thoroughly checking it for any possible yielding or errors, I realized that surely was not it.
That error will occur if your pierce handler has not returned by the time the next ray simulates, which means that it was still trying to process that pierce operation when it was ready to move on.
Hello, I just have to say that I love this module. One question though, is it possible to make the velocity of the projectile be zero while it’s in the air? for example if I cast the projectile and then press a button, then the projectile stops mid air until I press that key again, is there any way to do that or is that not a feature yet?.
Hi, I’m using FastCast for a tennis game I’m working on, and I’ve noticed that whenever FastCast spawns an object, it increases the network receive rate a lot. (7-10 kbps per ball spawned)
Do you know what may be causing this?
I’m using a replication method that replicates the position and velocity of the ball every time it’s hit on the server (remote event fire to every client available to update their client cast), but even when I disable that, I noticed that the network data incoming rate (specifically Data) is unusually high.
In the API there is a Pause() and Resume() for an ActiveCast, when you do Caster:Fire() it returns an ActiveCast, so you’d have to maybe pool all active casts in a table, they delete themselves when the bullet hits so might work.