How would I make a starterpack?

So for my game I want to add a starter pack that gives the player 100k cash and a car like:

The problem is I don’t know script so what should I try learning in script or how much would this cost?

I already have a a dealership that is made by Denokin on yt you can see it if you want to script it for me idc if you don’t I just wanna know how to do this:)

2 Likes

First off, you should watch some videos on gamepasses for roblox studio, here’s one that is pretty handy.

ok i know that but would i add a scipt that send the car to the players invatory if they have this pass

Do you want the car to be in the player’s backpack?

Or do you already have an inventory system for the cars you own.

image

That still doesn’t answer my question. All you showed was 2 folders of cars (that don’t even show the cars) and 4 script titles.

local ShopCars = game.ServerStorage:WaitForChild(“ShopCars”)
local PurchaseEvent = game.ReplicatedStorage:WaitForChild(“PurchaseCar”)
local PurchaseFailedEvent = game.ReplicatedStorage:WaitForChild(“PurchaseCarFailed”)
local AddCarEvent = game.ReplicatedStorage:WaitForChild(“AddCar”)
local GetCarParamsFunc = game.ReplicatedStorage:WaitForChild(“GetCarParams”)
local ServerPurchasedCars = game.ServerStorage:WaitForChild(“PurchasedCars”)

function AddCar(Cost, Cash, PurchasedCars, car, player, carname)
if Cost and Cash.Value >= Cost.Value and not PurchasedCars:FindFirstChild(carname) then
local ClonedCar = car:Clone()
ClonedCar.Parent = PurchasedCars
Cash.Value = Cash.Value - Cost.Value
AddCarEvent:FireClient(player, carname)
elseif Cost and Cash.Value < Cost.Value and not PurchasedCars:FindFirstChild(carname) then
PurchaseFailedEvent:FireClient(player, Color3.fromRGB(255, 0, 0), “Purchase failed.”)
elseif PurchasedCars:FindFirstChild(carname) then
PurchaseFailedEvent:FireClient(player, Color3.fromRGB(255, 0, 0), “You already have this car”)
end
end

PurchaseEvent.OnServerEvent:Connect(function(player, carname)
local leaderstats = player:FindFirstChild(“leaderstats”)
local PurchasedCars = ServerPurchasedCars:FindFirstChild(player.Name)
if leaderstats and PurchasedCars then
local car = ShopCars:FindFirstChild(carname)
if car then
local Cash = leaderstats:FindFirstChild(“Money”)
local Cost = car:FindFirstChild(“Cost”)
AddCar(Cost, Cash, PurchasedCars, car, player, carname)
end
end
end)

function comma_value(n)
local left, num, right = string.match(n, ‘^([^%d]%d)(%d)(.-)$’)
return left … (num:reverse():gsub(’(%d%d%d)’, '%1 '):reverse()) … right
end

function GetCarParams(player, carname)
local Result = {}
Result.Name = “No name”
Result.Cost = “No price”
Result.Power = “–”
local Car = ShopCars:FindFirstChild(carname)

if Car then
	local CarName = Car:FindFirstChild("CarName")
	if CarName then
		Result.Name = CarName.Value
	end
	local Cost = Car:FindFirstChild("Cost")
	if Cost then
		Result.Cost = Cost.Value > 0 and '$' .. comma_value(Cost.Value) or 'Free'
	end
	local Power = Car:FindFirstChild("Power")
	if Power then
		Result.Power = Power.Value
	end
end
return Result

end

GetCarParamsFunc.OnServerInvoke = GetCarParams

Name:DealershipScript this is the main functions