Simple way to prevent auto player/character module/script/audio insertion?

Hello Devforum, there is a tiny issue that i currently struggle a bit at.

For customization and full control over how the player moves, camera, etc
I write my own player modules, however, even on starter/custom character models Roblox seems to always
automatically insert the player modules (controls/camera) and the characters scripts (animate, health) and the humanoidrootpart always is filled with sound effects.

Is there a way I can completely prevent Roblox from automatically inserting player modules, scripts and sound effects since I do this with my custom system already? I scripted my own camera and movement and don’t need Roblox standard/default modules at all, they just clutter the game with unused scripts for me.

My current solution simply is having empty scripts with the name “PlayerModule” or “Animate” or have a script that removes those scripts on a ChildAdded event right when the player spawns but it feels so hacky and unnecessary to remove default player scripts and sound effects in the root with a ChildAdded event.

There also doesn’t seem like there is any sort of checkbox that I can (un)check to completely override/disable how Roblox handles movement/camera and character script insertion by default.

You could consider making so that Character Auto Loads is false
game:GetService("Players").CharacterAutoLoads = false

So then the characters wont load, and after a player joins you can add the character by yourself with a script.

I did knew about this before, but the thing is, I still want to spawn the character with :LoadCharacter or have it automatically spawn using the provided StarterCharacter, long ago when I did it this way it gave a lot of issues with GUI not being inserted when a player joined, etc and ended up having to do everything manually.

I just want the character stripped of scripts/sound effects and use my own camera/movement while still having the player spawn when they join preferably.

I didnt test this but maybe you can track the childs that are added at the model

	if child.Name == "Animate" then

You will do that for all the other scripts or instances that you dont want in your model.

I’m basically doing this right now.

When the player joins I manually strip them of any scripts/sound effects and the playermodule is replaced by placing an empty module inside the playerscripts with the name “PlayerModule”, but I feel like this is the dirty way of doing it.

Is there surely no other way to just disable auto-insertion while still having GUI inserted and StarterCharacter spawned normally? Just empty of scripts/sounds?

Edit: I currently just have this.

local entitybin = workspace.entities

		local player = game:GetService("Players"):FindFirstChild(object.Name)
		if player ~= nil then
			object.Parent = entitybin.players
			object:WaitForChild("Health", 5):Destroy()
			object:WaitForChild("Animate", 5):Destroy()

and it feels like a messy way to do it.

the code I said early will still work in this case, as the scripts are added constantly but they are removed constantly too. But that is also an option I believe

Ah I see, although, it does connect unnecessary events to the player model.
I’m trying to do this the cleanest way possible.

I’m coding for a group’s game and I’m replacing the entire player modules/character scripts due customized gameplay, the default Roblox modules feel too generic and they’re a hassle to modify/interact with.

My custom module completely changes how the player walks, turns camera, etc to enhance gameplay and make it feel like a completely new and different, fresh and polished game.

But Roblox keeps interferring by adding their own character scripts and trying to replace my control/camera modules.

then I would recomend what u said, adding those empty scripts so that they dont keep adding.

I would also recomend removing spawn() because there is no point to it, each function is a new thread.

And it is better to link it to the character model as your script fires each time a child is inserted in workspace and that could affect performance.

there is another way, you can make so that the player.character is equal to the model u said.

this will happen after the character loads and it can be what you are looking for as you will replace the character with the model. And all guis and scripts will fire

I used the spawn() since I wasn’t sure if the new thread-thing was still bugged.
I started wrapping certain things in spawn()s ever since that one bug that caused functions to write to the same variables/registers it kind of became a habit and I never really looked it it got fixed.

But I guess I’ll have to stick to using empty scripts/ChildAdded events then if there’s no other option to disable the automatic insertion.

You could wait for the character to load and then replace that {player}.Character = {model}

So then the guis will load and everything but what will happen is that the character will be replaced by your model and new scripts wont be added

Still feels a bit hacky but this could work, although I would have to adjust some code in my player module for that possibly since they do not exactly take sudden character replacement in mind, but thanks for the suggestion, might give that a try and see how well it works.

1 Like

if u wanna get rid of stuff why not just do

    Player.Character ---then delete all the stuff you dont want

Putting scripts or localscripts named the same way as the default scripts in startercharacter also basically disables the default functionality and placement of the default script.

I was aware of this, but then the sound effects that get inserted into HumanoidRootPart still pose a problem, I don’t use those default sound effects and they’re a bit harder to remove.

Weird, they shouldn’t be pasted in at all if you rename the scripts entirely, if it doesn’t cause issues I don’t recommend stressing about it as they shouldn’t do harm.