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

Script runs smoothly in studios but barley works and is slow in game?

Asked by 4 years ago

So this is a local script inside StarterPlayer scripts. There are 2 blocks in workspace called HOVER_WORK and HOVER_WORK1. It runs perfectly in Roblox Studios, but however when trying to do it in game it rather dosent do it or it does a long time after you hovered your mouse over it. The script works, its just frustratingly slow. I guess if someone can make this work without out the whole "Look around" thing that would be nice to. any help?

game.Workspace.HOVER_WORK1.ClickDetector.MouseHoverEnter:Connect(function()

local lookaround = 1

lookaround = math.rad(lookaround)



local player = game.Players.LocalPlayer

local cam = workspace.CurrentCamera

local mouse = player:GetMouse()

local subject = workspace.CamPos1



local measure = Instance.new("ScreenGui",player.PlayerGui)

local screensizex = measure.AbsoluteSize.X

local screensizey = measure.AbsoluteSize.Y

measure:Destroy()

wait()



print("Done")

cam.CameraType = Enum.CameraType.Scriptable



while true and wait() and player.Character.Humanoid.Health ~= 0 and subject do

cam.CoordinateFrame = subject.CFrame * CFrame.Angles(lookaround*(((screensizey/2)-mouse.Y)/screensizey)*2,lookaround*(((screensizex/2)-mouse.X)/screensizex)*2,0)

end

cam.CameraType = Enum.CameraType.Custom



end)





game.Workspace.HOVER_WORK.ClickDetector.MouseHoverEnter:Connect(function()

local lookaround = 1

lookaround = math.rad(lookaround)



local player = game.Players.LocalPlayer

local cam = workspace.CurrentCamera

local mouse = player:GetMouse()

local subject = workspace.CamPos



local measure = Instance.new("ScreenGui",player.PlayerGui)

local screensizex = measure.AbsoluteSize.X

local screensizey = measure.AbsoluteSize.Y

measure:Destroy()

wait()



print("Done")

cam.CameraType = Enum.CameraType.Scriptable



while true and wait() and player.Character.Humanoid.Health ~= 0 and subject do

cam.CoordinateFrame = subject.CFrame * CFrame.Angles(lookaround*(((screensizey/2)-mouse.Y)/screensizey)*2,lookaround*(((screensizex/2)-mouse.X)/screensizex)*2,0)

end

cam.CameraType = Enum.CameraType.Custom



end)
0
theres too much going on, and roblox's client connectivity to events is not all that great, so its making the game slow, either that or its your pc supercoolboy8804 114 — 4y
0
You should run as much as you can on the server if possible, there seems to be stress on the client. Fad99 286 — 4y
0
Well do you know a way to do it without the "Look around" thing? the camera attach thing dosent work, because you can move the camera around. Adenandpuppy 87 — 4y

Answer this question