...Mouseclick:Connect(function()
pop(game.Workspace.DS.D1) --pop being a function
you could try and straight up go with the function in the connect area, without building a function for that specific click
...Mouseclick:Connect(pop) --the pop function has the parameters as the mouseclick event
the parameters that you declared when you MADE the function will be the same in the function itself. What do I mean, well, the parameters that you use when you make the function will be nil in the moment you make the function, but when you declare them in an object (which involves a remoteevent and âconnectâ on it), those nil parameters turn into the remoteevent, so you donât have to declare them aside.
you are trying to do this with multiple of the variable D1
D2
D3
EtcâŚ
Each a different part
To give you some background the D= DecalPart 1 is the corresponding one, for example, DecalPart1, this is for a decal rent system and when I fire the server for the remote event I need to have the specific part to display the decal
From the very first post, I guess that you are not deleting the âcacheâ that is storing the gameâs id, it keeps it in it. Perhaps if you deleted the data number by turning it into a nil, like, whenever the player presses cancel, the game doesnât just close the HUD, it also deletes the data with something like
local data = game.Workspace.IntValue.Value --the intvalue would be where the ID number, not the object, is stored
if playerclosedtheIDtab then
closeIDtab()
data = nil --this all is an example, not working scripts...
from the next one, the one @Wunder_Wulfe is pointing, itâs simply that youâre declaring a function inside a function, it looks like this
local function myfunction()
print "Hello world!" --this would be the first function
Part.Touched:Connect(function() --this would be the second function
myfunction() --this now is the function inside a function
end)
you can straight up change it to be one singular function doing all of that, if you donât need to add anything else, which seems to me that you donâtâŚ
local function myfunction()
print "hello world!"
end
Part.Touched:Connect(myfunction)
you would need the former, but youâre seeming to be doing the latter. You already made the local function up in the main area of the script, yet you call another function that you donât needâŚ
Thanks so much for the help, one last thing If I were to use what you said and have a string value in the explorer to store the current decal part how could I reference a child of that part if its stored as a string?
I donât quite get what you mean, I need a bit more details.
I donât have modules very clear in my mind, but as far as I know, module(scripts) are for storing variables, specially functions, that you can use in more than one script. If you use a module it would be for storing a single fraction of data like an important table or an useful function.
If what youâre storing is an ID, I believe you shouldnât be storing it as a string, just an Int. Now, if itâs another thing what you mean, like a string partâs child, well you could make a stringvalue object in the workspace and put an empty decal as a child of that stringvalue, enter the ID for that decal, and probably referencing a child of that part would be possible;
now, Iâm not entirely sure, my biggest skill is not programming, you can see that Iâm the only one with a different title ITT. I understand some things about it, but itâs not my biggest strength, I believe if you could be more detailed I could understand
I just need to know if I were to use what you said and have a string value in the explorer to store the current decal part how could I reference a child of that part if its stored as a string? (Image reference above)
I believe I understand now. I need you to correct me if Iâm wrong, but you want to âstore the current decal id in a string value in an external part in the explorer, and then reference a child of that part but I canât because itâs a stringâ.
You donât need to reference the child of a string, you can just reference the child of the stringvalue object itself, by storing what you want to use (a decal in this situation) inside the stringvalue, you know, just dragging the decal inside the stringvalue object. And storing object inside object values is impossible. In the picture you mean the blue circle, which is showing me that whatâs important is the data block inside the DS folder, which I canât really connect with all thisâŚ
Also, on the image youâre making a value which must be a boolean (true or false) because youâre declaring if itâs false or not, but youâre talking about strings, which are word stores not true or falseâŚ
if game.Workspace.DS.data.Taken.Value == false then --[[value must be true or false, it's impossible for it to be a string because strings can't be true or false, just letters]]
No I meant the part that I will eventually display the decal on in a string, so I can then use it reference where to put the string onto, I need it in explorer as a string so the value doesnât turn into a table, so I wanted to know how I can use the string value, and depending on the object in the string find its specific child.
Make a variable, to that variable you define the value of that stringvalueâs value
If itâs a specific string find the child INSIDE the stringvalue, not the stringvalueâs value. So you would be looking at an objectâs child, not a valueâs child. You really canât look for the child of a value, just for the children of objectsâŚ
If iâm still not clear, tell me what would a player do if the script did work the way you intended. Like, what would the player experience
I think Iâm going to completely restart my script how do you think I should re format it
So to give you a full explanation of what Iâm trying to do, There are multiple parts where a decal can be stored like shown when one of these is clicked it pops up a gui asking if for the decal ID in a textbox then you have the choice of either pressing rent which fires the remote event changing the id for the decal on the part and subtracting the EP for the purchase and cancel obviously canceling the transaction the decal part would then change when the user leaves and another user buys it.
How would I go on on this?
Iâm sorry man, scripting isnât my biggest strength, and itâs not the time for me to write code. If I were you, Iâd just make sure that when you cancel, the decal id gets deleted by inserting it into a nil value, so it doesnât get stored in between cancellingâŚ