I’m trying to make some sort of over-the-shoulder type of game, so my gun casts a ray from the middle of the screen so the bullet can go towards the raycast’s result’s position.
The problem is that when using FastCast (Click here if you don’t know what FastCast is) and using the same method is that it doesn’t actually go towards the result’s position as shown in this recording:
I believe what is wrong is because the second parameter in the Fire function is the direction and not look at (like, look at from the Cframe.new()
), but, I don’t really know how to make it so the direction is the “look at” of the raycast result. Any help is appricated!
local function OnFire(plr, mouseHit, tool)
script.Parent.Fire:Play()
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {tool, tool.Handle.Shoot, plr.Character}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.IgnoreWater = true
local behavior = fastcast.newBehavior()
behavior.RaycastParams = raycastParams
behavior.AutoIgnoreContainer = true
behavior.CosmeticBulletTemplate = RS.TypesOfBoolets.AdminBullet
behavior.CosmeticBulletContainer = workspace.BooletZone
caster:Fire(tool.Handle.Shoot.Position, mouseHit, 10, behavior)
end