Hello. I was wondering how I could create a game that you could click on a booth that you can change the decal and text on it and own it? I tried and my efforts didn’t work. Where would I start?
How do you plan on changing it? Does the client have to edit the values when they click on it or does it do it automatically?
When they click on the booth, they own it. If they click on the booth they own I intend on popping up a GUI where you can insert your text and decal id, and when they press enter it changes the text and decal.
Add a click detector to the booth, when its fired, check if its owned. If not, give them ownership by adding their name to that booth in a table for example. Once the check has been completed, clone a GUI to their Player.PlayerGui with the fields you want. Once you have done that, fire the changes made by the client in the fields to the server (make sure you check it) and apply those changes to the booth.
how would I track if they already have a booth?
Iterate through the table using a for loop to check if their name is assigned to another booth.
Alright, last thing, how would I change the decal’s texture?
In the texture property you would type the following:
Decal.Texture = ("rbxassetid://"..IdGoesHere)
i meant like since a player will be pasting the decal id from the website, how would i get its thumbnail id
???
script.Parent.Parent.Frame.f.MouseButton1Click:Connect(function(plr)
local player = plr.Name
local booth = game.Workspace[plr.Name.."'s Booth"]
booth.Message.SurfaceGui.Letters.Text = script.Parent.Parent.Frame.Boothed.Text
if script.Parent.Parent.Frame.Main.Text == nil or "" or " " then
else
booth.MainImage.Decal.Texture = ("http://www.roblox.com/asset/?id="..script.Parent.Parent.Frame.Main.Text)
end
if script.Parent.Parent.Frame.Sub.Text == nil or "" or " " then
else
booth.Sub.Decal.Texture = ("http://www.roblox.com/asset/?id="..script.Parent.Parent.Frame.Sub.Text)
end
end)
script.Parent.Parent.Frame.Leave.MouseButton1Click:Connect(function(plr)
local player = plr.Name
local booth = game.Workspace[plr.Name.."'s Booth"]
booth.Owners.SurfaceGui.Letters = "Owned by no-one"
booth.Message.SurfaceGui.Letters = "Owned by no-one"
booth.MainImage.Decal.Texture = ""
booth.Sub.Decal.Texture = ""
end)
Gui code should be in a localscript and the actual server code should be in a server script.
if Main == nil or Main == “” is good practice. Would also recommend printing each of the sent variables to check what data youre passing. You only sent 2 values, however youre expecting 4 in your connection.
I sent 3, and I’m pretty sure the first value is the player.
It won’t print anything. I don’t know why. I put print(“Received”) but it didn’t print.