I have a model where I would need 40 copies off. It is finished and functional but I want more copies of it in the same game. Any idea on how I may pull this off?
Notes:
-The ScreenGUI named BoothGUI is the Gui that appears when you click to purchase the “booth” it has all of its functions and such.
-The ScreenGUI named color is the ColorWheel for the “booth” to set text colors and such.
-The RemoteEvent named “RemoteEvent” is for game teleportation in the portal.
-The RemoteEvent named “text” is for booth text.
-The RemoteEvent named “sound” is for booth sound.
-The RemoteEvent named “image” is booth image along with the other “imagedec”
-The RemoteEvent named “colorgui” is what colors the booth.
As I mentioned, assign each booth a name (e.g. 1-40 in your case) as reference for the server.
Your ScreenGUIs can send requests to the server (through your RemoteEvents) based on the booths name and the server will know which booth your client is requesting.
An example of a script with a RemoteEvent would be this
local text = script.Parent.Parent:WaitForChild("imageid")
local decal = game:GetService("Workspace").Primary1.Partee:WaitForChild("imageupload")
local event = game:GetService("ReplicatedStorage"):WaitForChild("image")
script.Parent.MouseButton1Down:Connect(function()
local textid = text.Text
event:FireServer(textid)
end)
So would I change
event:FireServer(textid)
to this?
event:FireServer(Primary1, textid)
event:FireServer(Primary2, textid)
event:FireServer(Primary3, textid)
event:FireServer(Primary4, textid)
-- and so on
You’re on the right track but your execution isn’t right,
If you named your booths a unique name as I mentioned (e.g. Booth1, Booth2), you can simply :FireServer() using said booths name so your server knows which booth to edit.
For example,
event:FireServer(script.Parent.Name, textid)
(assuming that script.Parent.Name is the booths name)
In your code above, you’re firing the event image, which I’m assuming is responsible for changing the image for the booth. So we’ll use that as an example.
Since you’re only changing that one booth that you own, you only need one :FireServer() in that code up there. No need for duplicate guis either.
Follow this same principle for your other guis and it should work out for you.
So would it be preferred to make a script in the Primary1 folder? With this execution, so I do not need to duplicate GUI’s? Because if I were to address it directly
event:FireServer(script.Parent.Name, textid)
then I would need to duplicate this script 40 times… Which way would be prefered?
I’m confused as to what you mean here, do you mean duplicating the LocalScript (which makes the requests) or duplicate the Server Script (which answers the request)?
For each booth wouldn’t I have to duplicate for example this script:
local text = script.Parent.Parent:WaitForChild("imageid")
local decal = game:GetService("Workspace").Primary1.Partee:WaitForChild("imageupload")
local event = game:GetService("ReplicatedStorage"):WaitForChild("image")
script.Parent.MouseButton1Down:Connect(function()
local textid = text.Text
event:FireServer(textid)
end)
Ah, well by duplicating your booth and making a request to the server with the booths name aforementioned (FireServer(boothName, textid)) it would duplicate it for you anyway and would still work, so yes.
Last thing: (Sorry for this going so long) Since this in the GUI BoothGUI I do not need to change the script, then how do I address each booth with FireServer(boothName, textid? This is what I am not quite getting.
local decal = game:GetService("Workspace").Primary1.Partee:WaitForChild("imageupload")
local event = game:GetService("ReplicatedStorage"):WaitForChild("image")
script.Parent.MouseButton1Down:Connect(function()
local textid = text.Text
event:FireServer(textid)
end)
In your snippet, assuming script.Parent is a ClickDetector, you could simply keep going up the object tree until you reach the model (e.g. script.Parent.Parent) and use that to find that specific booth.
Not sure why you have parts in the gui itself as these physical parts should be handled under workspace… maybe I have the wrong idea.
Nope, you are right. This is in the Workspace not in the GUI. Sorry for that confusion sometimes mistakes like this can be easily solved with major confusion.