Image Button activated twice per activation?

is this the entire output? what is line 150

it is outside any function. But let me fully explain what I’m doing in my code:
So basically I parent a model to the slots using a remote event (I parent it to the playerGui’s slots, not the slots inside starterGui), and that way I check if the slot has a child (which would be the model) it get’s that child and searches for it in a folder in ReplicatedStorage to spawn it in the actual game.

image

Could you print the parent of your GUI at the top of your script?

Also calling return; will stop script execution if you are not inside a function scope.
It seems your script isn’t actually running twice inside of StarterGui.

I believe getting the function traceback won’t help in this case as we’ve already established the script itself runs multiple times.

for clarification, what i meant by “slot function” is the function that initializes the slot buttons
local function Slots()
you should put the debug.traceback function under there
perhaps somewhere in your code you’ve accidentally did something that called it twice

image

image

it seems the script is running twice, it runs inside PlayerGui and inside StarterGui. Should I just destroy the script if it’s running inside StarterGui?

I believe that should work yeah. I would add a semicolon after the return statement like this: return; to make sure the compiler knows you’re line ends right after the return.

so something like this?
image

Not sure why my reply was put above yours.

I believe that should work yeah. I would add a semicolon after the return statement like this: return; to make sure the compiler knows your line ends right after the return.

alright, thanks for the help everyone

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.