How to script or make a car spawn on touch | scripting Roblox studio

Опубликовано: 28 Июль 2026
на канале: GGXDHyper
358
6

script : local part = script.Parent
local carTemplate = workspace:FindFirstChild("Car")
local carSpawned = false

part.Touched:Connect(function(hit)
if carSpawned then
return
end

local character = hit.Parent
local humanoid = character and character:FindFirstChild("Humanoid")
if humanoid and carTemplate then
-- Clone the car
local carClone = carTemplate:Clone()
-- Spawn the car a little offset from the part
local spawnCFrame = part.CFrame + Vector3.new(5, 0, 0)
carClone:PivotTo(spawnCFrame)
carClone.Parent = workspace
carSpawned = true
end
end)

#greenville #roblox #viral #fyp #scripting #robloxstudio