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
I got output exactly like your.
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
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.
Can you create each of the scripts you mentioned and run them with the following code, then share the output with me?
print(script.RunContext, script:GetFullName())
It’s not repro’ing properly… The LocalScript won’t run twice under the character anymore. It’s a really inconsistent bug. But previously the LocalScript has executed twice under the character with the same ancestry being printed with script:GetFullName()
.
Here’s the output from this test:
(ignore the bottom output which was from my PlayerGui)
I’ll leave this open for now, but without a repro it’ll be difficult to figure out exactly what’s going on. If you run into this again, please use that same code I shared before, send me a screenshot, and I’ll take another look.
Hey @WallsAreForClimbing, I found some what seemed like weird behaviour. I’m not sure if this is expected behaviour or not, but I thought I’d let you know just in case it relates to the issue at hand.
So, I was trying to reproduce this in a separate studio file, and I used 2 LocalScripts, one that forcibly crashes and times out, and another that waits for this. They both modify a BoolValue in ReplicatedStorage rapidly, but LocalScript2 does not begin running until LocalScript1 has finished:
I thought about this in one of my previous posts:
and the output screenshot I showed above makes me think this more and more - LocalScript2 does not run until LocalScript1 finishes, and since LocalScript1 is doing a very memory heavy task, it does not allow for LocalScript2 to run. My guess is that, since this only happens for me in my game with a large loading screen, the loading screen script, etc. are using a precise amount of memory, maybe just enough to allow other LocalScripts to start running, then those other LocalScripts stop, and then start again.
Anyway, it’s just a theory, and I thought I’d let you know about this behaviour just in case it relates to the actual bug.
Here’s the file I used for this:
potential bug help.rbxl (53.5 KB)
Please note that as I said before, there is a LocalScript in that file which intentionally crashes (using while true do end
).
Hello. I will try to reproduce it creating new places or using old ones. As you said, it’s a really inconsistent bug.
That’s actually my code that you quoted there. You’re explanation isn’t exactly correct. Instance:FindFirstAncestorOfClass()
locates and returns the first instance of the given type if it’s an ancestor of the calling instance. If not, then it returns nil. So you will get a player instance back if the script is running under the Player. Else you will get nil. That’s the only way that I have found to deal with this issue.