I am making a portal fps game (def not splitgate trust) and I have portals working via EgoMoose’s portal system. I am new to using this portal system and I have some questions:
[1]: this says it is inefficient, how do I make it more efficient as it may need to render multiple players?
-- copy the character (this is the most performance intensive part of the code... lol)
self.FakeCharacterA:Destroy()
self.FakeCharacterA = cloneCharacterModel(self.Character, self.Next.CFrame, self.Last.CFrame)
self.FakeCharacterA.Parent = self.LastWindow.ViewportFrame
self.FakeCharacterB:Destroy()
self.FakeCharacterB = cloneCharacterModel(self.Character, self.Last.CFrame, self.Next.CFrame)
self.FakeCharacterB.Parent = self.NextWindow.ViewportFrame
[2]: how would I make portals work on all clients? so if one client shoots a portal, the others will see it.
[3]: how would I make the game as efficient as possible?
[4]: is this the wrong category? if so, what is the correct one?
[5]: has someone already made a portal system that works with multiple players and fits my needs?
-- copy the character (this is the most performance intensive part of the code... lol)
self.FakeCharacterA:Destroy()
self.FakeCharacterA = cloneCharacterModel(self.Character, self.Next.CFrame, self.Last.CFrame)
self.FakeCharacterA.Parent = self.LastWindow.ViewportFrame
self.FakeCharacterB:Destroy()
self.FakeCharacterB = cloneCharacterModel(self.Character, self.Last.CFrame, self.Next.CFrame)
self.FakeCharacterB.Parent = self.NextWindow.ViewportFrame
Problem
Every frame (or very frequently), you’re destroying and re-cloning the entire character.
That means tons of Instance creation/destruction, property copying, and re-parenting, all inside ViewportFrames — extremely expensive.
Fixes
You can make this much more efficient by:
Reusing fake characters instead of recreating them.
Clone once, then update their CFrames every frame instead of destroying/recloning.
For example:
if not self.FakeCharacterA then
self.FakeCharacterA = cloneCharacterModel(self.Character)
self.FakeCharacterA.Parent = self.LastWindow.ViewportFrame
end
updateCharacterModel(self.FakeCharacterA, self.Character, self.Next.CFrame, self.Last.CFrame)
Use ViewportFrame.CurrentCamera cleverly.
Instead of rendering every object twice, render the world once per portal via a dedicated camera.
EgoMoose’s system supports this — just disable player replication per frame and only update camera transform.
Disable accessories or complex parts when not visible (LOD / Level of Detail).
For distant portals, hide detailed parts.
Throttle updates.
You don’t need to update every frame; maybe every 2–3 frames (33–50ms) is fine.
Use RunService.Heartbeat:Connect but add throttling.