I am using this tutorial on how to make a turret
I am fairly new to scripting so I don’t understand much, so i just copied the script from the description but i followed everything leading up to the script and it says this in the dev console.
Do you know how to fix this here is the code:
‘’’
local Platform = script.Parent.Poles
local Rotor = script.Parent.Rotor
local seat = script.Parent.VehicleSeat
local rot = 0
local sp = script.Parent
seat.ChildAdded:connect(function(object)
if object:IsA(“WeldConstraint”) and object.Name == “SeatWeld” then
local player = game.Players:GetPlayerFromCharacter(object.Part1.Parent)
local gui = script.Client:clone()
gui.Parent = player.PlayerGui
wait()
seat.ChildRemoved:connect(function(object)
gui:Destroy()
end)
end
end)
game:GetService(“RunService”).Stepped:connect(function()
if seat.Throttle == 1 then
Rotor.WeldConstraint.C0 = Rotor.WeldConstraint.C0 * CFrame.fromEulerAnglesXYZ(math.rad(-0.75),0 ,0)
elseif seat.Throttle == -1 then
Rotor.WeldConstraint.C0 = Rotor.WeldConstraint.C0 * CFrame.fromEulerAnglesXYZ( math.rad(0.75),0 ,0)
end
if seat.Steer == 1 then --right
Platform.WeldConstraint.C0 = Platform.WeldConstraint.C0 * CFrame.fromEulerAnglesXYZ(0, math.rad(-0.75) ,0)
rot = rot - 0.75
elseif seat.Steer == -1 then
Platform.WeldConstraint.C0 = Platform.WeldConstraint.C0 * CFrame.fromEulerAnglesXYZ(0, math.rad(0.75), 0)
rot = rot + 0.75
elseif seat.Steer == 0 then
end
end)
local fire = game.ReplicatedStorage.Fire
fire.OnServerEvent:Connect(function(player)
if player.Character.Humanoid.SeatPart == script.Parent.VehicleSeat then
local cannonball = game.ReplicatedStorage.Lazer
local cannonspawn = script.Parent.LazerFire
print('fire')
local cannonClone = cannonball:Clone()
cannonClone.Parent = game.Workspace
cannonClone.Position = cannonspawn.Position
cannonClone.Orientation = cannonspawn.Orientation
print('fire')
local canonspawnclone = cannonspawn:Clone()
canonspawnclone.Anchored = true
while true do
cannonClone.Velocity = canonspawnclone.CFrame.lookVector * 200
wait()
end
canonspawnclone:Destroy()
end
end)
‘’’