Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Script GUI Car spawner into Filtering Enabled?

Asked by 6 years ago

So this is a very complicated script that I have for my game. I am trying to get the script to work with an event but I don't know how since it works with the GUI.

wait(0.5) script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.BG.Visible = not script.Parent.Parent.BG.Visible end)

and there is a frame named BG, then outside the frame is the actual script that spawns the car

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

local vehicles = { -- {NAME , THUMBNAIL ID} {"2012 Audi Q7" , 1307478175}, {"2016 BMW 320i" , 1307489492}, {"2013 Chevrolet Camaro" , 1307492649}, {"2007 Chevrolet Impala" , 1307496811}, {"2014 Chevrolet Impala" , 1307500734}, {"2011 Chevrolet Spark Hatchback", 1307506017}, {"1999 Chevrolet Suburban" , 1307510076}, {"2015 Chevrolet Suburban" , 1307514338}, {"2007 Chevrolet Tahoe" , 1307518935}, {"2015 Chevrolet Tahoe" , 1307518935}, {"2004 Chevrolet Trailblazer" , 1307528777}, {"2013 Chrysler 300" , 1307532980}, {"2005 Chrysler PT Cruiser" , 1307537781}, {"2013 Dodge Charger" , 1307541222}, {"2002 Dodge Durango" , 1307545088}, {"2011 Dodge Grand Caravan" , 1307553952}, {"2013 Dodge Journey" , 1307556489}, {"2006 Dodge Ram 1500" , 1307559347}, {"2013 Dodge Ram 1500" , 1307564329}, {"2013 Ford Explorer" , 1307569339}, {"2017 Ford Explorer" , 1307577617}, {"1993 Ford F-150" , 1307582833}, {"2011 Ford F-150" , 1307585958}, {"2017 Ford F-150" , 1307599269}, {"2004 Ford Focus Hatchback" , 1307610226}, {"2013 Ford Focus Hatchback" , 1307620242}, {"2005 Ford Mustang GT" , 1307623933}, {"2015 Ford Mustang GT" , 1307629169}, {"1999 Ford Taurus" , 0}, {"1998 GMC Sierra" , 1307631584}, {"1997 GMC Sonoma" , 1307635861}, {"2004 GMC Yukon" , 1307633959}, {"2004 Honda Accord" , 1307638106}, {"2009 Honda Accord Sport" , 1307641467}, {"1999 Honda Civic Coupe" , 0}, {"2010 Honda Civic" , 0}, {"2015 Honda Civic Type R" , 1307644425}, {"2012 Honda Crosstour" , 1307650110}, {"2000 Honda CR-V" , 1307647766}, {"2013 Hyundai Accent Hatchback", 1307653590}, {"2008 Hyundai Elantra" , 1307656321}, {"2013 Hyundai Santa FE" , 1307658810}, {"2012 Hyundai Sonata" , 1307663535}, {"2016 Hyundai Sonata" , 1307666751}, {"2005 Infiniti G35 Coupe" , 1307670224}, {"2003 Infiniti G35 Sedan" , 1307672635}, {"2013 Jeep Wrangler" , 1307675118}, {"2004 Lincoln Town Car" , 0}, {"2005 Lincoln Town Car Limo" , 1307677393}, {"2015 Kia Optima" , 0}, {"2015 Lexus GS350" , 1307679796}, {"2011 Lexus GX460" , 1307682020}, {"2008 Lexus ISF" , 1307685989}, {"2004 Lexus RX300" , 1307689165}, {"2004 Mazda 3" , 1307692006}, {"2015 Mercedes C250 Coupe" , 1307694821}, {"2014 Mercedes C63" , 1307697688}, {"2016 Mercedes CLA250" , 1307702942}, {"2015 Mercedes G65" , 1307705912}, {"2009 Mercedes GL450" , 1307709727}, {"2014 Mercedes S550" , 1307713607}, {"2015 Mercedes G65 Coupe" , 1307713607}, {"2013 Mercedes Sprinter" , 1307725061}, {"2009 Nissan Altima" , 1307729323}, {"2014 Nissan Maxima" , 1307742022}, {"2010 Nissan Pathfinder" , 1307747417}, {"2003 Nissan Quest" , 0}, {"2012 Nissan Sentra" , 0}, {"1995 Plymouth Voyager" , 1307751515}, {"2009 Scion XB" , 1307754132}, {"2016 Tesla Model S" , 0}, {"2016 Tesla Model X" , 0}, {"1999 Toyota Camry" , 0}, {"2004 Toyota Camry" , 1307756874}, {"2007 Toyota Camry" , 1307759108}, {"1993 Toyota Corolla" , 0}, {"2008 Toyota RAV4" , 1307762029}, {"2015 Volkswagen Beetle" , 1307765022}, {"2013 Volkswagen Jetta" , 1307767227}, {"2007 Volvo S80" , 1307769293}, {"2016 Volvo XC90" , 1307772010} }

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 (locked) then return end locked = true local vehicleName = player.Name.."Car" if (not workspace:FindFirstChild(vehicleName)) then local model = game.ServerStorage.Vehicles:FindFirstChild(vehicles[index][1]):Clone() model.Name = vehicleName model.Parent = game.Workspace model:MakeJoints() model:MoveTo(player.Character.Torso.Position + Vector3.new(10, 0, 0)) bg.Visible = false else bg.S.Text = "Sell your old vehicle first!" wait(1) bg.S.Text = "Spawn" end locked = false end)

game.Players.PlayerRemoving:connect(function(player) if workspace:FindFirstChild(player.Name.."Car") then workspace:FindFirstChild(player.Name.."Car"):Destroy() 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)

SetInformation(index)

Help would be appreciated, thanks!

(Script about wouldn't go into code)

0
I can't script but it would be better if you put all the code in the scripts into a LUA text. To do that, edit this post and click on the LUA icon, then, '~~~~~~~~~' and another '~~~~~~~~' should have appeared. Copy and paste the script you had between those 2 '~~~~~~~~~~~" and bam! You should have a very organised LUA script! It would be easier to read your question then! :D dadysherwin2 155 — 6y
0
Google RemoteEvents and RemoteFunctions. MachoPiggies 526 — 6y
0
Hey I was wondering if you can give me a copy so I can see what I can do. FPSVision -14 — 6y

Answer this question