local Projectile = script.Projectile
local ProxProm = script.Parent.ProximityPrompt
local VehicleSeat = script.Parent.Parent.VehicleSeat
local canshoot = true
local function FIRE()
Projectile.Effects.Enabled = true
local c = Projectile:Clone()
c.Name = "Bomb"
c.Parent = workspace
c.Velocity = (c.CFrame.LookVector * 250)
c.Effects:Destroy()
c.Touched:Connect(function(hit)
if not hit:IsDescendantOf(script.Parent.Parent) then
local explosion = Instance.new("Explosion",workspace)
explosion.Position = c.Position
c:Destroy()
end
end)
wait(0.5)
Projectile.Effects.Enabled = false
wait(4)
ProxProm.Enabled = true
end
local db = false
local CanJoint = VehicleSeat.Cannon
local Cannon = script.Parent
local RE = game.ReplicatedStorage.PositionCannon
ProxProm.Triggered:Connect(function(plr)
if VehicleSeat.Occupant ~= nil and VehicleSeat.F.Force == Vector3.new(0,0,0) and canshoot == true then
RE:FireClient(game.Players:GetPlayerFromCharacter(VehicleSeat.Occupant.Parent))
Projectile.BrickColor = BrickColor.new("Really red")
RE.OnServerEvent:Connect(function(plr,pos)
if VehicleSeat.Occupant.Parent.Name == plr.Name then
Projectile.BrickColor = BrickColor.new("Really black")
local off = CFrame.Angles(0,math.rad(180),0) -- positioning starts here
CanJoint.C1 = CFrame.lookAt(CanJoint.C1.Position,pos):Inverse()*off -- end
FIRE()
end
end)
end
end)
VehicleSeat.F.Changed:Connect(function()
if VehicleSeat.F.Force ~= Vector3.new(0,0,0) then
ProxProm.Enabled = false
else
ProxProm.Enabled = true
end
end)
the code above is the code for a cannon system I am making and it position the cannon 180 degrees wrong and cant point upwards nor downwards the “pos” variable is just the mouse.hit.position