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.
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.
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
workspace.ChildAdded:Connect(function(object)
spawn(function()
local player = game:GetService("Players"):FindFirstChild(object.Name)
if player ~= nil then
wait(.1)
object.Parent = entitybin.players
object:WaitForChild("Health", 5):Destroy()
object:WaitForChild("Animate", 5):Destroy()
end
end)
end)
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.
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.
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.
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.
You can just add a module script to StarterPlayerScripts named “PlayerModule” to stop the default PlayerModule from loading as well as any other default scripts on the player.