Hello! I’m trying to make a Spawn-Car-Script but the only problem is, that the car is a model and not an union. Everytimes I try to position the primaryPart (which is the Seat) only the Seat gets positioned and not the entire car. I did weld it.
Script (Not done yet though)
local touchPart = workspace.spawnPart
local replicatedStorage = game:GetService("ReplicatedStorage")
local gamePassId = 10736903
local marketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local jeep = replicatedStorage.Jeep
local posPart = workspace.pos
local function spawnJeep(playerName)
if not workspace:FindFirstChild(playerName.. "'s Jeep") then
local clone = jeep:Clone()
clone.Parent = workspace
clone.PrimaryPart.Position = posPart.Position + Vector3.new(0, 2, 0)
clone.Name = playerName.. "'s Jeep"
return "Done"
end
end
local function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid") then
local hum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
local char = hum.Parent
local plr = players:GetPlayerFromCharacter(char)
local async = marketPlaceService:UserOwnsGamePassAsync(plr.UserId, gamePassId)
if async then
--Let him spawn the Jeep
spawnJeep(plr.Name)
else
--Prompt it
marketPlaceService:PromptGamePassPurchase(plr, gamePassId)
end
end
end
touchPart.Touched:Connect(onTouch)
Any solutions? Thank you!