Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)
0
Any errors? And when you put the script as a descendant did you check if it was actually there in the explorer? oftenz 367 — 5y
0
No errors and I made sure it was in the explorer. Beastlance 22 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
The PlayerAdded event in Script 1 meant that when a player joins it will add Script 2 to their player inventory. Beastlance 22 — 5y
Ad

Answer this question