Game fully works in studio but crashes in game. (might be engine bug?)

this has been hurting my brain for over a week

single player:


multi player:

roblox player:

starter player scripts:
image
code (local script):

local player = game.Players.LocalPlayer
local characterLoadEvent = game.ReplicatedStorage.CharacterLoadEvent
characterLoadEvent:FireServer()
local character
local collider
player.CharacterAdded:Connect(function(newCharacter: Model)
	character = newCharacter
	collider = newCharacter:WaitForChild("Collider")
end)

local camera = workspace.CurrentCamera

local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")

local compile = require(script.Compile)


userInputService.MouseDeltaSensitivity = 0.01
local inputDirection, grounded
local jumping = false

--EveryFrame
runService.RenderStepped:Connect(function(deltaTime)
	compile.camera(collider, camera, Vector3.new(0, 2.3, 0))
end)


--PrePhysicsSimulation
runService.PreSimulation:Connect(function(deltaTimeSimulation)
	local simulationCorrection = deltaTimeSimulation * 240
	
	inputDirection, grounded = compile.getMovementDetections(character, collider, camera)
	if grounded and not jumping then
		compile.groundMovement(collider, inputDirection, 20, 20, 32, simulationCorrection)
	else
		compile.airMovement(collider, inputDirection, 100, 32, simulationCorrection)            
	end
end)


--OnInput
userInputService.InputBegan:Connect(function(inputObject)
	if inputObject.KeyCode == Enum.KeyCode.Space and grounded and not jumping then
		compile.jump(collider, 30)
		jumping = true
		task.wait(0.2)
		jumping = false
	end
end)
1 Like

I’ve been having a similar issue recently. My game works perfectly fine in Studio but then bugs start to occur in the Roblox player.

ah yeah my game has a weird custom character so it just fully wont let me join

1 Like

It’s likely a roblox server is a cause of problem bacause the the problem states its from “network issues”

1 Like