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
ProxProm.Triggered:Connect(function(plr)
if VehicleSeat.Occupant ~= nil and VehicleSeat.F.Force == Vector3.new(0,0,0) and canshoot == true then
game.ReplicatedStorage.PositionCannon:FireClient(game.Players:GetPlayerFromCharacter(VehicleSeat.Occupant.Parent))
ProxProm.Enabled = false
game.ReplicatedStorage.PositionCannon.OnServerEvent:Connect(function(plr,pos)
if VehicleSeat.Occupant.Parent.Name == plr.Name and not db then
db = true
local off = CFrame.Angles(0,math.rad(-180-90),0) -- offset
VehicleSeat.Cannon.C0 = CFrame.new(VehicleSeat.Cannon.C0.Position,pos)*off -- just positions
FIRE()
db = false
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 “pos” below the off part is Mouse.Hit.Position now idk why maybes its sum problem with my cannon or something here is the model if u want
Raft.rbxm (43.5 KB)