Hello, I am creating a building/sandbox game that uses physics similar to the roblox game Fling Things and People by Horomori.
The problem is that I noticed this problem where studio would just crash at random for no apparent reason while playing. I found 0 pattern when this happens, and it only looks to be happening on this game. It has only crashed once in roblox even after a lot of play time. The thing that have my suspicion but I do not think is the problem is the constant firing of a remotevent. This is fired so the server can get the CFrame of the player’s camera and move the object with this properly so the object being held is not just sitting in one direction. Ive tried looking at the server memory but it seems to be a client issue because the server does not crash on roblox. Does anyone have a solution to this?
The issue most likely has something to do with a RemoteEvent being spammed. There is no limit in Roblox Studio on how many Remotes can be fired within a short time frame, unlike on the actual game instance where the limit is 50KBPS I believe. The issue is most likely that you are firing remotes at an absurd speed ( maybe using something such as renderstepped or touched to fire the remote? ), which is causing your Studio to crash from running too many remotes, and your normal game to deny the remotes. I’m pretty sure the in-game data limit is set to prevent exploiters destroying server performance.
Follow these steps and send me a screenshot of what you see:
Join your game in Roblox, not Studio
Press F9 to open Developer Console
There should be a button to view the server output, click on that
Repeat the steps of whatever it is that is crashing your game in Studio, and send me a screenshot of what the server output says
In that case please also include your code of the script that you think is the culprit
If you don’t know which script is causing the issue, try disabling 1-3 scripts at a time until you finally get the game to run in Studio without crashing.
okay, i did what you asked before, but got nothing from roblox. I did it in studio but it did not crash, but i noticed the highlights for when you pick something up(server) stopped working and this error came up:
while wait() do
local char = LP.Character
if down and char ~= nil then
local j = (camera.CFrame.LookVector*distance)+camera.CFrame.Position
local dist = math.clamp(math.abs(char.HumanoidRootPart.Position.Magnitude-j.Magnitude), 7.5, 15)
distance = dist
distance = math.clamp(distance, 7.5, 15)
tar = mouse.Target
repeat
drag.Visible = true
hit = (camera.CFrame.LookVector*distance)+camera.CFrame.Position
dragger:FireServer(hit, tar, true)
wait()
until down == false
wait()
dragger:FireServer(mouse.Hit, mouse.Target, false)
drag.Visible = false
repeat wait() until down == true
end
end
down is just with Mouse, I have a rblxscriptsignal that checks if the mouse is down and then toggles down. Also, i looked it up, apparently the error comes from those highlights.
I’m not sure if this will somehow change anything, but this line is redundant since you already have everything in a while wait() do loop. Remove this line: repeat wait() until down == true
It also looks like you left out a lot of variable definitions in the script so it’s hard for me to comprehend some of it
LP = game.Players.LocalPlayer
mouse = LP:GetMouse()
local UIS = game:GetService("UserInputService")
dragger = game.ReplicatedStorage:WaitForChild("dragReq")
welder = game.ReplicatedStorage:WaitForChild("weldReq")
down = false
distance = 10
LP:WaitForChild("PlayerGui")
LP.PlayerGui:WaitForChild("MainGui")
local Gui = LP.PlayerGui.MainGui
drag = Gui.DragStuff
closer = drag.Close
farther = drag.Far
mouse.Button1Down:Connect(function()
down = not down
end)
UIS.InputBegan:Connect(function(input)
distance = math.clamp(distance, 7.5, 15)
if (UIS:GetFocusedTextBox()) then
return
end
if input.KeyCode == Enum.KeyCode.R then
distance += 2.5
end
if input.KeyCode == Enum.KeyCode.F then
distance -= 2.5
end
if input.KeyCode == Enum.KeyCode.Q and down then
welder:FireServer()
end
distance = math.clamp(distance, 7.5, 15)
end)
local onDrag
function cancelReq()
down = false
end
onDrag = dragger.OnClientEvent:Connect(cancelReq)
camera = workspace:WaitForChild("Camera")
drag.Visible = false
closer.MouseButton1Down:Connect(function()
distance -= 2.5
distance = math.clamp(distance, 7.5, 15)
end)
farther.MouseButton1Down:Connect(function()
distance += 2.5
distance = math.clamp(distance, 7.5, 15)
end)
while wait() do
local char = LP.Character
if down and char ~= nil then
local j = (camera.CFrame.LookVector*distance)+camera.CFrame.Position
local dist = math.clamp(math.abs(char.HumanoidRootPart.Position.Magnitude-j.Magnitude), 7.5, 15)
distance = dist
distance = math.clamp(distance, 7.5, 15)
tar = mouse.Target
repeat
drag.Visible = true
hit = (camera.CFrame.LookVector*distance)+camera.CFrame.Position
dragger:FireServer(hit, tar, true)
wait()
until down == false
wait()
dragger:FireServer(mouse.Hit, mouse.Target, false)
drag.Visible = false
print("done")
end
end
First thing I noticed, you have about 3 mousebutton1down functions and one userinput function, this is also completely redundant as all 3 will be run when the player left clicks, so you may as well put them all under the same mousebutton1down event
Anyway, the issue should be this:
repeat
drag.Visible = true
hit = (camera.CFrame.LookVector*distance)+camera.CFrame.Position
dragger:FireServer(hit, tar, true)
wait()
until down == false
An empty wait parameter is about 0.03 seconds, so you are essentially firing a remote event along with the other 3 lines of code 33.33~ times per second, which easily exceeds the data limit and will not only stop the remotes from working, but even if they were to work it would kill your server performance. You have no way of changing the value of the variable “down” to false, so this repeat loop will never stop. You may have attempted to redefine “down” in the server script, however keep in mind that variables cannot be transferred from the server to the client unless they are _G variables (global variables).