Lower screen resolution causes movement to be faster

I’m making an Undertale fan game but I’ve ran into an issue with the battle system movement.

When your screen resolution is lower or higher, you move faster or slower than intended. I suspect this is because the movement system moves you forward one pixel forward each frame, a lower resolution means less pixels which means you’d move faster or slower depending on the pixel density.

My question is how would I fix this?

Movement code:

local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function(deltatime)

	if (ForwardsPressed) then
		PlayerSprite.Position -= UDim2.new(0, 0 , MoveSpeed * deltatime / PlayerSprite.Parent.AbsoluteSize.Y, 0) 
	end
	if (BackwardsPressed) then
		PlayerSprite.Position += UDim2.new(0, 0 , MoveSpeed  * deltatime / PlayerSprite.Parent.AbsoluteSize.Y, 0)
	end
	if (LeftPressed) then
		PlayerSprite.Position -= UDim2.new(MoveSpeed * deltatime  / PlayerSprite.Parent.AbsoluteSize.X, 0 ,0 , 0)
	end
	if (RightPressed) then
		PlayerSprite.Position += UDim2.new(MoveSpeed * deltatime / PlayerSprite.Parent.AbsoluteSize.X, 0 ,0 , 0)
	end 
end)

This is probably not related to the screen size but rather to the frame rate.
RunService is frame rate-based, so if your code revolves around it, the function will be called every frame, so any change that makes your fps reach the limit you set will affect your code.

Use RunService.Heartbeat if your task is time sensitive.

You could try using scaled distances. instead of moving fixed amounts, move speed would need to be recalculated as a proportion of the absolute size.
Or, set all distances using UDim2.fromScale() and adjust the move speed to be a fixed scalar amount (like 0.01 or something).

I can see you’ve already adjusted for deltatime

Sure, but i use deltatime which prevents speed by being affected by framerate so you move the same speed no matter the framerate

Figured out the reason for this was because it was using the parent frame size, which changes with the resolution making movement speed unpredictable. Setting it to a set number fixed it