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

How do i make Cars spawner GUI Shop?? with Filtering Enabled on?

Asked by 6 years ago

I tried to script about Cars spawner GUI shop that alot Cities game do, i try to search online like Youtube. but since filtering enabled on, it wont worked. i dont want my game exploited tho... anyone help me please??

1
We don't provide full scripts here but we will help you with a broken one. Read up about scripting on wiki.roblox.com and check out some free models that do this and see how they work and then try and apply their methods to yours. After you have your script, if it still doesn't work, let us know. TheBenSquare 47 — 6y

1 answer

Log in to vote
2
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
6 years ago

Welcome to the realm of Remote Events and Functions

For this task, we will specifically use the Remote Events

What exactly is Remote Event?

Remote Events are Roblox Instances that allows you to communicate with two different scripts. Some of these actions can only be performed by server and some can only be done with client. When creating a game, you need to identify which action is suitable for server and client.

Basically think of it as an another version of Bindable Event. However, Do Not confuse Remote Event with Bindable Event. They are not the same.

How to implement Remote Event in the game?

Remote Events are usually placed in ReplicatedStorage because ReplicatedStorage can be accessed by both Server and Client Script.

To implement Remote Event in the game, the following steps are used:

  • Hover over to Replicated Storage
  • Right click on it
  • Type in Remote Events or scroll down till you find one.
  • Click on it to insert the Remote Event

Now we move on to scripting

Firstly, you want to make sure you have 2 different scripts. One script is a Server Script while the other is Client Script. The Server Script; we will call it Cloner, goes to ServerScriptService. The Client Script; we will call it EventFirer, goes to your Graphic User Interface button.

-- Declaration Section [EventFirer]
-- //Game Services 
local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- //Remote Event Location 
local ModelCloningEvent = ReplicatedStorage:WaitForChild("ModelCloningEvent")

-- //Gui Location 
local ScreenGui = PlayerGui:WaitForChild("ScreenGuiName")
local TextButton = ScreenGui:WaitForChild("TextButtonName")

-- Processing Section 
local function FireModelCloningEvent ()
    ModelCloningEvent:FireServer()
    print("Fired Server")
end 

-- Connecting Section 
TextButton.MouseButton1Down:Connect(FireModelCloningEvent)

Basically the script above is firing the Remote Event when the TextButton is pressed.

-- Declaration Section 
-- //Game Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local Workspace = game:GetService("Workspace")

-- //Cloning Model Location 
local Car = ServerStorage:WaitForChild("Car")

-- //Remote Event Location 
local ModelCloningEvent = ReplicatedStorage:WaitForChild("ModelCloningEvent")

-- //Variables 
local NewCar 

-- Processing Section 
local function CloneCarToWorkspace ()
    NewCar = Car:Clone()
    NewCar.Parent = Workspace
    NewCar:MakeJoints()
    print("Cloned Car in Workspace")
end 

-- Connecting Section 
ModelCloningEvent.OnServerEvent:Connect(CloneCarToWorkspace)

The script above is the main code. When the ModelCloningEvent is fired, the function will begin to process. The Car found in ServerStorage ; Note: The Car's location is for this tutorial is in ServerStorage ; is cloned to the Workspace

Please do keep in mind that this is just a basic script. You can do many more cool things with it. However my objective is to guide you, not give you free script.

Hope you learned something from this. Check out more

Ad

Answer this question