Hey! I’m wondering how I would make my mouse in-game become a cross-hair Like the one down below, and how I would lock it to the center of the screen.
I’ve tried using an image label but the mouse isn’t centered on the screen. Even in the first person, the mouse isn’t in the absolute middle.
This might help:
local UserInputService = game:GetService("UserInputService")
wait(1)
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
UserInputService.InputChanged:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
print("Mouse delta is (" .. tostring(inputObject.Delta.X) .. ", " .. tostring(inputObject.Delta.Y) .. ")")
end
end)
This script was used from the DevHub, you can view the full article here: Customizing Mouse Icons | Roblox Creator Documentation
Scroll down to Lock Mouse Position
Hope this helps!
Use the mouse’s icon
property
and to make it stay in middle of screen, set the player’s camera mode to first person unless you want the player to be third person
Example Script:
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = "http://www.roblox.com/asset?id=163023520" -- Mouse Icon Url
1 Like
Have you tried firstpersonlocked? It’s a feature that many first person combat games use.