But why? I have been trying to fix this for over 2 hours. I did randomize the name of the script to check if there is two different numbers but it seems like its caused by one script and that this is not caused by duplication.
This only happens when I clone a model and then attach a script to it.
local c = game:GetService("CollectionService")
c:GetInstanceAddedSignal("a"):Connect(function(b)
local a = script.ModuleScript:Clone()
a.Parent = b
require(a)
end)
local part = game.ServerStorage.Part:Clone()
part.Parent = workspace
this code is causing this problem but i am not sure why
Can you explain why you are using collection service? Also, I would suggest giving more descriptive names to your variables using names like “a” and “b” is bad practice.
Edit: I tested your first script and the triggered even only fired once for me.
Thanks for the file. I’ll take a look right now.
Edit: So, I took a look into it and I couldn’t find any reason for it to trigger twice. The method your using to add the proximity prompt doesn’t make much sense. I would suggest adding it on the collection service event and connecting the event there. You’re making a module script for each part and using the fact that requiring the module script runs the code inside it. But, in the end this does seem like a bug.
Indeed, that’s what I was trying to prove, it is not what I expected it to do. Should I mention Roblox staff here? As this issue is really unexplainable to me.
You can make a bug report in #bulletin-board and ask for it to be moved. I’m just going to check this one more time to confirm it. I couldn’t replicate this, I think I’m just missing something.
From what I understand a part is cloned and parented to workspace which causes “InstanceAdded” to be fired from collection service since the part has a tag. Then, a proximity prompt is added to it through a module script parented to the part. This module script connects to the triggered event of the proximity prompt, which in theory should only fire once. I probably am being dumb, but I just don’t get what’s causing it.