Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

runService.HeartBeat slowing down part movement script?

Asked by 2 years ago

Hello I am making a script that allows the player to manipulate position and rotation of a part, I have this working fine how ever, when using a heartbeat event my fps / lag will get progressively worse the longer I am manipulating the part. At about the 3000th iteration it becomes really noticeable. Any suggestions or solutions would be appreciated. this script I've dumbed down can be copy / pasted straight into a local script inside the player to test.

01-- variables
02local uis = game:GetService("UserInputService")
03local cam = game.Workspace.CurrentCamera
04local runService = game:GetService("RunService")
05local connection = nil
06local part = Instance.new("Part")
07part.Parent = workspace
08local alignPos
09local alignRot
10local attch
11 
12-- returns mouse location in 3d space
13local function getMouse()
14    local x = uis:GetMouseLocation().X
15    local y = uis:GetMouseLocation().Y
View all 64 lines...

1 answer

Log in to vote
1
Answered by 2 years ago

Roblox studio loses fps when it has a lot of stuff in the output console for some reason. I suggest you try removing the print(1) in the getMouse() function

0
It works thank you, strange ig roblox stores each print function as a variable instead of overriting it. Code1400 75 — 2y
Ad

Answer this question