How To Make a Turret in Roblox

Опубликовано: 16 Июль 2026
на канале: Funjack17Gaming
36,648
697

I will be making a player controlled Turret in roblox studio. I hope you enjoy the video and hoped you learned something aswell.

Model:
https://www.roblox.com/library/560286...




Script:

local Platform = script.Parent.Movement
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("Weld") 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.Weld.C0 = Rotor.Weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(-0.75),0 ,0)

elseif seat.Throttle == -1 then



Rotor.Weld.C0 = Rotor.Weld.C0 * CFrame.fromEulerAnglesXYZ( math.rad(0.75),0 ,0)
end
if seat.Steer == 1 then --right
Platform.Weld.C0 = Platform.Weld.C0 * CFrame.fromEulerAnglesXYZ(0, math.rad(-0.75) ,0)
rot = rot - 0.75


elseif seat.Steer == -1 then
Platform.Weld.C0 = Platform.Weld.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)

Local Script/Client:

local player = game:GetService("Players").LocalPlayer
local character = player.Character
local d = false;

local uis = game:GetService("UserInputService")



uis.InputBegan:Connect(function(key, event)

if key.KeyCode == Enum.KeyCode.F then

if d == true then return end
d = true;
print('Fire')

local fire = game.ReplicatedStorage.Fire

fire:FireServer()
wait()
d = false;

end
end)