Hi, so i´m just starting to code with LUA and Roblox and I am making a racing game in which the player will select in the beginning from a GUI which car they want to ride (yellow, red, blue, etc), but in this specific script I just want to do the test with the yellow one.
The problem that I have is that many players can select the same type of car, so I have the cars hidden beneath the map and I just need to clone them to an specific position depending on the players choice.
My question is if it is possible to set the position of a model or how can I clone a model but move it to a different position instead of the starter position itself.
local yellowCar = game.Workspace.yellowCarTest
local seat = yellowCar.VehicleSeat
--This function is to clone the Yellow Car
local function cloneYellow()
local copyYellow = yellowCar:Clone()
copyYellow:MakeJoints()
copyYellow.Parent = game.Workspace
copyYellow:MakeJoints()
copyYellow.Position = Vector3.new(217.669, 59.275, -334.282)
end
--This functions is to close the GUI that will appear to the player
local function closeWindow()
local window = script.Parent.Parent.Parent.Parent.Parent.SelectCar
window:Destroy()
end
--This function will be active when the car button is pressed
script.Parent.MouseButton1Click:connect(function()
cloneYellow()
closeWindow()
--wait(1)
--Move the player to the car's seat
game.Players.LocalPlayer.Character.UpperTorso.CFrame = CFrame.new(seat.Position)
end)
If you need additional info just let me know, thank you!

1 comment
Models don't have positions