Roblox Forum banner
1 - 4 of 4 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter · #1 ·
I am trying to clone() a car from ServerStorage and I was informed that I needed to call :MakeJoints() on the clone. I tried doing :Clone():MakeJoints() and that didn't work but it did if I named the model. The problem is that the car spawns every time someone respawns for their character, there will be a lot with the same name, and the car breaks without :MakeJoints(). I thought a good solution would be to name the model a name and have an increasing variable but I can't seem to get that to work.. Does anyone have a solution? Here is the code:

function onSpawned(plr)
local kart = game.ServerStorage["Cart"]:Clone()
kart.Parent = game.Workspace
kart:MakeJoints()
end

function onChanged(prop,plr)
if prop=="Character" then
onSpawned(plr)
end
end

function onAdded(plr)
plr.Changed:connect(function(prop)
onChanged(prop,plr)
end)
end

game.Players.PlayerAdded:connect(onAdded)
 

·
Registered
Joined
·
10 Posts
This is my setup, however, mine works by having a GUI button and it spawns a car.

repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Rp = game.ReplicatedStorage
local V1 = Rp.Vehicles.Fast
exist = 0

script.Parent.Fast.MouseButton1Click:connect(function()

local ClonedVehicle = V1:Clone()
ClonedVehicle.Parent = workspace
ClonedVehicle:MakeJoints()
ClonedVehicle.PrimaryPart = ClonedVehicle.Main
ClonedVehicle:SetPrimaryPartCFrame(Character.Head.CFrame)

end)
 
1 - 4 of 4 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top