Hi i am making a video calling system. So lets just get straight to the point

I took a free model phone system, and used viewport frames and boatbomber's Viewport frame handler and then put it to the test.

So i equipped it, and instantly a ton of lag. (i was at like 7 fps) And also i noticed that i have a unanchored radio (its welded) and then that started flying and stuff then i unequipped it, and everything was super laggy but no gravity bending.

Let me specify hierarchy stuff

script.Parent is the viewport frame script.Parent.Parent is the gui Tool object value is the caller's or calling tool

Anyways, let me show you the script

local module = require(game.ReplicatedStorage:WaitForChild("ViewportHandler"))
local VF_HANDLER = module.new(script.Parent)
local tool = script.Parent.Parent:WaitForChild("Tool").Value
local camera = Instance.new("Camera")
script.Parent.CurrentCamera = camera
camera.Parent = script.Parent
local connection1 = game["Run Service"].RenderStepped:Connect(function()
	if tool then
		if tool.Calling.Value then
			local player = game.Player:GetPlayerFromCharacter(tool.Calling.Value.Parent)
			camera.CFrame = player.Character.Head.CFrame * CFrame.new(0,0,-5) * CFrame.new(player.Character.Head.CFrame * CFrame.new(0,0,-5),player.Character.Head.CFrame)
		end
	end
end)

for i,v in pairs(game.Workspace:GetDescendants()) do
	if v:IsA("BasePart") and not v:IsA("Terrain") and not game.Players:GetPlayerFromCharacter(v.Parent) then
		wait() --added a wait in both for i,v in pairs cause it literally crashed my roblox client without it
		VF_HANDLER:RenderObject(v,60)
	end
end

game.Players.PlayerAdded:Connect(function(player)
	VF_HANDLER:RenderHumanoid(player.Character or player.CharacterAdded:Wait())
end)
for i,v in pairs(game.Players:GetPlayers()) do
	wait()
	VF_HANDLER:RenderHumanoid(v.Character or v.CharacterAdded:Wait())
end

Really hope that i can find a fix! And as always, Thanks!

4 comments

0

OTHER INFO: In the microprofiler, prepare is very big when i equip it a few times.

0

Did some stuff, it lags less but instead of moving the radio, it moves the player and also in the output on client, it spams maximum event re-entrancy depth exceeded for instance.descendantadded when i equip it, however when i do the opposite, maximum event re-entrancy depth exceeded for instance.descendantremoving pops up

0

UPDATE: I have done a test and tried making it not detect the cellphone when you equip it, and there is no more lag! Problem is, bending gravity is still there. But i took my time to take this really funny picture with me looking like i am walking on the gui!

0

https://prnt.sc/10lwumt Here is the picture