Hey devs,
I’m wanting to know if it’s possible for a bullet to travel the same speed no matter where it’s going to hit in a tween.
Here’s what I have at the moment:
game.ReplicatedStorage.RemoteEvents.MakeBullet.OnServerEvent:Connect(function(plr, start, finish)
bulletClone = bullet:Clone()
bulletClone.Parent = workspace
bulletClone.CFrame = start
game.TweenService:Create(bulletClone, tweenInfo, {CFrame = CFrame.new(finish) * CFrame.Angles(start.Rotation.X, start.Rotation.Y, start.Rotation.Z)})
plr.Character.Head.ShootSound:Play()
flash = flash:Clone()
flash.Parent = plr.Character.RightHand
wait(0.05)
flash:Destroy()
end)
9100ryan
(Equinox)
July 21, 2022, 1:27am
2
make a TweenInfo.new() and then just change the time property
9100ryan
(Equinox)
July 21, 2022, 1:27am
3
it should be the first number in the TweenInfo
3Ogre
(3Ogre)
July 21, 2022, 1:30am
4
local BulletSpeed = 10 -- How fast you want the bullet to travel
local Distance = (TweenStartPosition - TweenEndPosition).Magnitude
local TweenTime = Distance / BulletSpeed
3 Likes
9100ryan
(Equinox)
July 21, 2022, 1:33am
5
BriefYayyayyay:
game.ReplicatedStorage.RemoteEvents.MakeBullet.OnServerEvent:Connect(function(plr, start, finish)
bulletClone = bullet:Clone()
bulletClone.Parent = workspace
bulletClone.CFrame = start
game.TweenService:Create(bulletClone, tweenInfo, {CFrame = CFrame.new(finish) * CFrame.Angles(start.Rotation.X, start.Rotation.Y, start.Rotation.Z)})
plr.Character.Head.ShootSound:Play()
flash = flash:Clone()
flash.Parent = plr.Character.RightHand
wait(0.05)
flash:Destroy()
end)
game.ReplicatedStorage.RemoteEvents.MakeBullet.OnServerEvent:Connect(function(plr, start, finish)
bulletClone = bullet:Clone()
bulletClone.Parent = workspace
bulletClone.CFrame = start
local MyInfo = TweenInfo.new(time to travel here)
game.TweenService:Create(bulletClone, MyInfo, {CFrame = CFrame.new(finish) * CFrame.Angles(start.Rotation.X, start.Rotation.Y, start.Rotation.Z)})
plr.Character.Head.ShootSound:Play()
flash = flash:Clone()
flash.Parent = plr.Character.RightHand
wait(0.05)
flash:Destroy()
end)
can’t you just do something like this?
3Ogre
(3Ogre)
July 21, 2022, 1:38am
6
Sure you could do that but I was just showing how he could get the time for the tween