You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to make a “Motor Vehicle” Spawner. -
What is the issue? Include screenshots / videos if possible!
robloxapp-20240529-1122278.wmv (2.4 MB) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked all over the DevForum, and I can’t find a solution.
Script:
local Players = game:GetService("Players")
local InsertService = game:GetService("InsertService")
local MotorSpawnerTool = script.Parent
local _Function = MotorSpawnerTool:FindFirstChild("RemoteFunction")
MotorSpawnerTool.Equipped:Connect(function(_mouse)
local Character = MotorSpawnerTool.Parent
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
local Player = Players:GetPlayerFromCharacter(Character)
MotorSpawnerTool.Activated:Connect(function()
if not MotorSpawnerTool.Debounce.Value then
MotorSpawnerTool.Debounce.Value = true
local Motor = InsertService:LoadAsset(14362437183):GetChildren()[1]
Motor.Parent = workspace
Motor:PivotTo(CFrame.new(_mouse.Hit.Position) * CFrame.fromEulerAnglesXYZ(0, math.rad(Character.PrimaryPart.Orientation.Y), 0))
local vehicleSeat = Instance.new("VehicleSeat")
vehicleSeat.Parent = Motor
vehicleSeat.TopSurface = Enum.SurfaceType.Smooth
vehicleSeat.BottomSurface = Enum.SurfaceType.Smooth
vehicleSeat.Size = Vector3.new(2, 0.25, 2)
vehicleSeat.BrickColor = BrickColor.new("Black")
local vehicleSeatWeld = Instance.new("Weld")
vehicleSeatWeld.C0 = CFrame.new(0, -0.125, 0)
vehicleSeatWeld.C1 = CFrame.new(-1, 0.125, -1.25)
vehicleSeatWeld.Parent = vehicleSeat
vehicleSeatWeld.Part0 = vehicleSeat
vehicleSeatWeld.Part1 = Motor.PrimaryPart
local Seat1 = Instance.new("VehicleSeat")
Seat1.Parent = Motor
Seat1.TopSurface = Enum.SurfaceType.Smooth
Seat1.BottomSurface = Enum.SurfaceType.Smooth
Seat1.Size = Vector3.new(2, 0.25, 2)
Seat1.BrickColor = BrickColor.new("Black")
local SeatWeld1 = Instance.new("Weld")
SeatWeld1.C0 = CFrame.new(0, -0.125, 0)
SeatWeld1.C1 = CFrame.new(1, 0.125, -1.25)
SeatWeld1.Parent = Seat1
SeatWeld1.Part0 = Seat1
SeatWeld1.Part1 = Motor.PrimaryPart
wait(1.5)
MotorSpawnerTool.Debounce.Value = false
end
end)
end)