You can't, the best thing you can do is include a wait and have dropoff calculated in the local script. then transfer it all to the main script with the remote event. If you want a bullet to travel along a path with raycast you need to use tweening, I'll provide an example from my raycast pistol main script below:
script.Parent.BulletEvent.OnServerEvent:Connect(function(Player, FromP, ToP, BulletPos)
if script.Parent.AbleToShoot.Value == true then
if first == true then
table.insert(tab, Player.Character)
first = false
end
local RayCast = Ray.new(FromP,(ToP-FromP).unit*500)
Part,Position,Normal = game.Workspace:FindPartOnRayWithIgnoreList(RayCast,tab,false,true)
local Dist = (ToP-FromP).magnitude
if not Dist then Dist = 300 end
local projectile = script.Parent.Bullet.Projectile:Clone()
projectile.Parent = game.Workspace
projectile.CFrame = CFrame.new(BulletPos, ToP)
projectile.Tracer.Enabled = true
Hole = game.ReplicatedStorage:FindFirstChild("GlockBulletHole"):Clone()
local Info = TweenInfo.new(
(ToP-script.Parent.Parts.BE.Position).magnitude/457,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Goals =
{
Position = ToP
}
local BulletTween = TweenService:Create(projectile, Info, Goals)
BulletTween:Play()
if (ToP-script.Parent.Parts.BE.Position).magnitude <= 1000 then
game.Debris:AddItem(projectile, (ToP-script.Parent.Parts.BE.Position).magnitude/457)
elseif (ToP-script.Parent.Parts.BE.Position).magnitude > 1000 then
game.Debris:AddItem(projectile, 2.2)
end
end
wait((ToP-script.Parent.Parts.BE.Position).magnitude/457)
if Part ~= nil then
1 comment
Um, what? A raycast isn't an object, it can't have velocity. In this case, just don't use raycasts and shoot out a normal bullet.