LocalScripts in StarterCharacterScripts are being run twice (not Scripts with RunContext set to Client)

Is it by any mean possible to show code in the CharacterAdded block?

idk, i mean theres a lot of characteradded connections i have but it’s only a RBXScriptSignal and it does not modify the character in any way.

I also mentioned this issue is inconsistent - I just tried to repro it and couldn’t. Sometimes it happens and sometimes not.

I see I just noticed that in the picture you send in other post (below here) have no Animate script which usually included by default so I just think at least there are script that handle delete and adding stuff to player’s character.

That was a bug from some of my other code. In one of my previous replies, I mentioned the character getting cloned and the LocalScripts instantly getting removed from it, then it getting put into a ViewportFrame. Well, I referenced my character there by mistake which caused that.

I took another look at that because I thought it could be causing issues and fixed that to reference the cloned character and then tested again to make sure.

The code at the top of the script:

print("this script is so freaking awesome!")
if not script:IsDescendantOf(workspace) then print("oi! this script not in the workspace!") script:Destroy() end
print("hmmhmhmhmmhm")

I got this output:


which shows the script got destroyed but is still running, this time with the “Studio” tag for source. It says “Source not available” when hovering, so it definitely got destroyed.

I think something is going on with viewport cloning?

Here is my viewport script and explorer

local plr = game:GetService("Players").LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()

char.Archivable = true

local cloned = char:Clone()

char.Archivable = false
cloned.Parent = script.Parent.ViewportFrame.WorldModel

image

I got output exactly like your.
image

Have you tried delete local script in viewport before parent them?
like

local plr = game:GetService("Players").LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()

char.Archivable = true

local cloned = char:Clone()

char.Archivable = false

--Delete script in cloned model for viewport
for _,v in cloned:GetChildren() do
	if v:IsA("LocalScript") then
		v:Destroy()
	end
end

--Set to world model
cloned.Parent = script.Parent.ViewportFrame.WorldModel

Here is my output after delete script in viewport
image

yep i did exactly that but each time i made it also print script:GetFullName() (this is with the viewport script disabled so the character is not cloned) so then for the messages that did have a source i opened them and clicked “Show in Explorer” and they all point to that one LocalScript under my character.