Hi,
Again on this Framework, I am now scripting Client → Server Interactions and when i came to scripting my bullet I encountred a problem, the bullet once fired, spawns up in the air and have a big offset from the attachment.
I have it inside a Part :
!And this scrips that is supposed to make Bullet velocity :
local Events = game.ReplicatedStorage.Events
Events.Fire.OnServerEvent:Connect(function(player, FirePartPos, MouseHitPosition)
local Bullet = game.ReplicatedStorage.Bullet:Clone()
Bullet.Position = FirePartPos
coroutine.wrap(function()
Bullet.Parent = workspace
Bullet.CFrame *= CFrame.new(FirePartPos, MouseHitPosition) -- Update
local loop
loop = game:GetService("RunService").Heartbeat:Connect(function(dt)
Bullet.CFrame *= CFrame.new(0, 0, -10 * (dt*60))
if(Bullet.Position - FirePartPos).magnitude >= 1000 then
Bullet:Destroy()
loop:Disconnect()
end
end)
end)()
-- Hit detection + raycats
Thanks !