You can write your topic however you want, but you need to answer these questions:
-
So, I have a CIWS antiaircraft with a bullet welded to the barrel and I have a tween for shooting it.
-
However, when I test it, is goes way out to the side
-
I tried asking chat gpt, reviewing my code, and I’ve spent a long time trying to fix this. Any suggestions?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is my code
local debrisService = game:GetService("Debris")
while true do
local clone = script.Parent.Bullet:Clone()
clone.Parent = game.Workspace
clone:breakJoints()
clone.Anchored = true
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
local tween = game:GetService("TweenService"):Create(clone, tweenInfo, {Position = (script.Parent.Bullet.CFrame.LookVector* 10)})
script.Parent.Attachment.FX:Emit(1)
tween:Play()
clone.Trail.Enabled = true
script.Parent.FlashFX.Enabled = true
task.delay(1, function()
clone.Touched:Connect(function(hit)
if hit.Name ~= "Bullet" and hit.Name ~= "barrel" then
local explosion = Instance.new("Explosion")
explosion.Position = clone.Position
explosion.Parent = game.Workspace
explosion.BlastRadius = 10
explosion.Visible = true
explosion.BlastPressure = 0
clone:Destroy()
end
end)
end)
wait()
script.Parent.FlashFX.Enabled = false
debrisService:AddItem(clone, 3)
end