Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help removing the money part of this Car Spawning Script?

Hello, I am currently needed help with making this Car Spawner script to just spawn for free as you can see I have attempted to make it free but you still have to buy it for $10k not $0. I have tried a lot and I would like it if someone could give me some insight to how to make it free or remove the money needed part intirely.

local P = script.Parent
local player = P.Parent.Parent
local index = 1

local vehicles = {
--  {NAME						, THUMBNAIL ID}
	{"Black Taurus RCMP"	, 0}, --LEAVE ALL THUMBNAIL ID AS 0. THERE IS NO POINT FOR A PICTURE.
	{"Crown Vic RCMP"	, 0},
	{"Undercover RCMP"	, 0},
	{"Undercover RCMP"	, 0},
	{"Unmarked Ford Tarus RCMP"	, 0},
	
}

wait(0.5)
-- GUI vars
local bg = P.BG

-- Helper function
function SetInformation(index)
	bg.I.Image = "http://www.roblox.com/thumbs/asset.ashx?assetId="..vehicles[index][2].."&x=420&y=420"
	bg.T.Text = vehicles[index][1]
end

local locked = false
bg.S.MouseButton1Click:connect(function()
	local Money = player.leaderstats:FindFirstChild("Money")
	if Money.Value > 0 then
		Money.Value = Money.Value - 1
		
	if (locked) then return end
	locked = true
	local vehicleName = player.Name.."Car"
	local model = workspace:FindFirstChild(vehicleName)
	if (model) then model:Destroy() end
	model = game.ServerStorage.Vehicles:FindFirstChild(vehicles[index][1]):Clone()
	model.Name = vehicleName
	model.Parent = game.Workspace
	model:MakeJoints()
	model:MoveTo(P.Regen.Value.Position)
	P:Destroy()
	locked = false	
		
	else
		script.Parent.BG.S.Text = "Not Enough Money, $1.00 Needed!"
		wait(3)
		script.Parent.BG.S.Text = "Select"
	end
end)

bg.B.MouseButton1Click:connect(function()
	index = index - 1
	if (index < 1) then index = #vehicles end
	SetInformation(index)
end)

bg.N.MouseButton1Click:connect(function()
	index = index + 1
	if (index > #vehicles) then index = 1 end
	SetInformation(index)
end)

bg.Q.MouseButton1Click:connect(function()
	P:Destroy()
end)

SetInformation(index)

2 answers

✓ Accepted answer

The only thing relating to paying money in this script is located on line 27 where it checks if you have money then removes 1 from your cash. I don't see anything that takes away that cash so Im guessing your problem lies in another script, but here is this script without anything money related to it

local P = script.Parent
local player = P.Parent.Parent
local index = 1

local vehicles = {
--  {NAME                       , THUMBNAIL ID}
    {"Black Taurus RCMP"    , 0}, --LEAVE ALL THUMBNAIL ID AS 0. THERE IS NO POINT FOR A PICTURE.
    {"Crown Vic RCMP"   , 0},
    {"Undercover RCMP"  , 0},
    {"Undercover RCMP"  , 0},
    {"Unmarked Ford Tarus RCMP" , 0},

}

wait(0.5)
-- GUI vars
local bg = P.BG

-- Helper function
function SetInformation(index)
    bg.I.Image = "http://www.roblox.com/thumbs/asset.ashx?assetId="..vehicles[index][2].."&x=420&y=420"
    bg.T.Text = vehicles[index][1]
end

local locked = false
bg.S.MouseButton1Click:connect(function()
    if true then

    if (locked) then return end
    locked = true
    local vehicleName = player.Name.."Car"
    local model = workspace:FindFirstChild(vehicleName)
    if (model) then model:Destroy() end
    model = game.ServerStorage.Vehicles:FindFirstChild(vehicles[index][1]):Clone()
    model.Name = vehicleName
    model.Parent = game.Workspace
    model:MakeJoints()
    model:MoveTo(P.Regen.Value.Position)
    P:Destroy()
    locked = false  

    else
        script.Parent.BG.S.Text = "Not Enough Money, $1.00 Needed!"
        wait(3)
        script.Parent.BG.S.Text = "Select"
    end
end)

bg.B.MouseButton1Click:connect(function()
    index = index - 1
    if (index < 1) then index = #vehicles end
    SetInformation(index)
end)

bg.N.MouseButton1Click:connect(function()
    index = index + 1
    if (index > #vehicles) then index = 1 end
    SetInformation(index)
end)

bg.Q.MouseButton1Click:connect(function()
    P:Destroy()
end)

SetInformation(index)

4 comments

0

Okay, thank you I will test it, but if it doesn't work I will post a little bit more scripts. I will post the Car Spawner script it self I guess.

0

@Zachz_Attack do not make new questions, edit this one

0

@DanzLua okay, I currently have found the other script. All I want to do is make it so these cars are free instead, of costing money I will post the next script in.

0

@DanzLua, I posted the next info below on my Answer version of the Money Script that you found out also.

Here is the next script that creates the money, is there someway to make the two scripts make it so that the Car's are free and don't request this money script to spawn the cars.

function Entered(player)
        wait()
        if player:findFirstChild("leaderstats") ~= nil then
	
        end

      local stats = Instance.new("IntValue")
        stats.Parent = player
        stats.Name = "leaderstats"

      local money = Instance.new("IntValue")
        money.Parent = stats
        money.Name = "Money"--Moneys name, Like 'Turkish Lira' or 'Money' or 'Dollers' or 'Iraqi Dinar'
        money.Value =  50000  --How much you start out with change it to how much you want
end

game.Players.PlayerAdded:connect(Entered)

c = game.Players:GetChildren()
for i=1, #c do
        Entered(c[i])
end
--454 Studios, User454

















6 comments

0

One tip , try learn from this , don't copy it and edit it. Understand it.

0

@arshad145, Okay but I don't really understand Lua and I haven't learned it yet because no one wants to teach me.

0

@arshaal145 I have attempted to learn stuff about theese scripts and I am currently retyping a script I will be testing it in a few mins.

0

There is nothing relating to taking away money in this script

0

Okay, so is this the script you are looking for or no?

0

nope

This discussion is preserved as it was. New answers, comments, and votes are closed.