Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Does copying a script into a Players inventory mess with how it works?

In order to check and update what stats a player has I made Script 2. When tested in a separate model where a Folder was copied repeatedly into another part in the model it worked fine. But when copied into the Player (not Character model) of a new Player who joins it seems to not work at all with no output. Any help?

Script 1: Script that clones script 2 and sets it's parent:

local original2 = game.ReplicatedStorage.test
		
		local copy2 = original2:Clone()
		
		copy2.Parent = player.leaderstats

Script 2: Script to detect when a new Descendant is added:

local sP = script.Parent 

sP.Parent.DescendantAdded:connect(function(descendant)
	print(descendant)
end)

2 comments

0

Any errors? And when you put the script as a descendant did you check if it was actually there in the explorer?

0

No errors and I made sure it was in the explorer.

1 answer

I'm assuming you had a PlayerAdded event in your first script? And It shouldn't.

1 comment

0

The PlayerAdded event in Script 1 meant that when a player joins it will add Script 2 to their player inventory.

This discussion is preserved as it was. New answers, comments, and votes are closed.