what its supposed to do (added 70 pixels on mouse.y)
adding 70 pixels on y fixed it, but not for all devices, am I missing something?
local mousePos = Vector2.new(mouse.X, mouse.Y) --or add 70 (mouse.Y + 70)
local partPos = workspace.CurrentCamera.ViewportSize / 2
local direction = (mousePos - partPos).Unit
local angle = math.atan2(direction.Y, direction.X)
snappedAngle = angle
part.Orientation = Vector3.new(0, 0, -math.deg(angle))
kexy123
(kexy123)
August 30, 2024, 10:33pm
#2
The Mouse.Y
property doesn’t calculate above depending on the screen. It always calculates it’s Y-position relative to the bottom of the top bar.
The problem is, the top bar is different between Roblox Studio and Roblox Player.
Roblox Studio’s new top bar is 60 pixels.
Roblox Player’s top bar is 30 pixels.
Therefore, you may see offsets whenever you use the property.
Use RunService:IsStudio()
to change the offsets as so:
local runService = game:GetService("RunService")
local offset
if runService:IsStudio() then
offset = 60
else
offset = 30
end
This could be because of gui inset, try doing something like this
local guiservice = game:GetService("GuiService")
local players = game:GetService("Players")
local localpalyer = players.LocalPlayer
local mouse = localpalyer:GetMouse()
local inset = guiservice:GetGuiInset()
local mousePosition = Vector2.new(mouse.X, mouse.Y - inset.Y)
yeah but isnt every screen size different? wouldnt the offset be different on every device
system
(system)
Closed
September 13, 2024, 10:35pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.