How would I unlag the following script? (localscript)
local player = game.Players.LocalPlayer
local uispart = Instance.new("Part", workspace)
uispart.Transparency = 0
uispart.Anchored = true
uispart.Size = Vector3.new(1,1,1)
while wait() do
print("ready to move")
uispart.Position = player.Character.HumanoidRootPart.Position + Vector3.new(2,0,2)
print("moved")
end
Instead of while wait() do you can use game:GetService("RunService).Heartbeat:Connect(function()) if you want something to happen every frame, which would be much smoother than using a while loop
If you are using the new “expressive output” - disable that feature and use the old one. The new one has performance issues when printing constantly.