Strange Behavior with RunContext

I am having an issue with Scripts, that have a RunContext set to client, inside the StarterCharacterScripts

Before I go and post this as a bug, I thought I would see if maybe I just don’t understand why this is happening, or if its happening to anyone else.

The issue
If I have 2 scripts in StarterCharacterScripts
one is a Script with RunContext as Client
the other is just a normal LocalScript

image
image

both scripts have the same code…

print(script.Name..".Parent = "..script.Parent)

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

print(script.Name.." Found Humanoid")

The output I get is this…

So from that I see that both scripts, printed out the correct Parent, and they both found the Humanoid in their parent (the Character)

However, then it throws an error, acting as if somehow a clone of the ‘Script’ is trying to run inside StarterCharacterScripts, without placing it inside a ‘Character’

Is this normal with Scripts set to run as Client?

1 Like

The Script is essentially running in both the Character, and inside StarterCharacterScripts which is why its both working and not working.

I dont think its normal though, I think its a Bug, and should Probably be Reported as such.

Edit: I found why,

How does RunContext interact with ‘Starter’ containers?

Starter containers work by cloning their contents locally therefore they will make a copy of any scripts contained in them. If you are using one of the new RunContexts such as Client or Server then both the original scripts and their copies will run. Therefore, you should continue to use the Legacy RunContext or LocalScripts in these containers.

3 Likes

Ah, thank you, I had a feeling, because it was not reported as a bug, that there might be something I didn’t know about.

Thanks for finding this for me.

This seems like something that would be worth adding a warning for. I’ll create a ticket internally for this. Thanks for the report!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.