Right now im working on making a “ghost mode” for my game (i.e. you cant interact with players who are alive and can just move around the map)
Currently, my plan is to have 2 CollisionGroups, one for ghosts and one for regular players, and make them unable to collide with each other. Once the player wants to enter ghost mode, all of their parts will be added to the Ghost CollisionGroup and they will be teleported to the map. While in Ghost Mode, all of their parts will be set to 1 Transparency on the server and 0.75 on the client. The client will also set CanTouch on all the parts to false (to make the player unable to pick up tools)
Before i actually make this i was just wondering if anyone knew any ways that would be more efficient
Do the collision grouping. But, differ at the server part.
Tag their Character via CollectionService with like ‘Ghost’. We use CollectionService so you can account for streaming enabled via :GetInstanceAddedSignal(tag).
Then, on all clients, use render tie-in with RunService:BindToRenderStep() that sets the current tagged characters’ BasePart’s LocalTransparencyModifier (this is a hidden property a lot of people don’t know exists) to 1 if its someone else’s character, and then to 0.75 if it’s their own character.
-- inside BindToRenderStep...
for _, tagged in TaggedCharacters do
local ours = (client.Character == tagged)
for _, bp in tagged:GetDescendants() do
if bp:IsA("BasePart") then
bp.LocalTransparencyModifier = ours and 0.75 or 1
end
end
end
The only person who has the ghost is the local player. But if your game has streaming enabled, you might have to send ghost positions to the server to tell the server to stream around the ghost’s position.
i dont think its spawning in anything except just tagging it, its still the player’s character. you’re gonna see odd behavior setting the character during runtime like this that i think is unnecessary.
Character management would need to be rewritten because LoadCharacter does not work on the client at all, however I think that this is a better approach for server performance.
You also wouldn’t set Player.Character. Just insert all the scripts yourself and edit the PlayerModule. Then, lastly, you wouldn’t even need to change CameraModule, you can just set the subject to the humanoid.