I’m trying to replace the players cursor with a ImageLabel inside a ScreenGUI
--This is the code inside my ScreenGUI
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local GUI = script.Parent
Mouse.Icon = "http://www.roblox.com/asset/?id=2300836745"
GUI.Enabled = true
This is my code so far basically it’s just setting the actual mouse icon to a blank image so there simply isn’t one. The image label uses my real crosshair image. Now you may be wondering why I don’t just change the Mouse.Icon to the image I want to use, and there’s a couple reasons for that.
First of all I noticed when I do just change the mouse icon to the image I want to use the icon would move a pixel when I would click, and then back a pixel when I move the mouse. This is undesirable in an FPS game, and I don’t know how to fix it.
Secondly I figure using a GUI would allow more customization and more easily anyway.
Now if you disagree with these points and know how I can fix the first issue then by all means explain away, but for now I’m trying to use a GUI.
The problem I’m currently trying to fix with the GUI is basically that I’m struggling to get the image to the proper center of the screen. Here’s an image showing what I’m talking about:
The ImageLabel is a size of 100x100 and set directly inside of my ScreenGUI. I’ve set it’s position to {0.5, -50},{0.5, -50}. Which my understanding is that it should be perfectly centered, but as you can see that is clearly not the case. I’m trying to get my GUI crosshair to be directly inside the real mouse cursor. In fact I believe the ImageLabel IS centered on the X axis, but not the Y axis. Perhaps the reason is because of the roblox bar at the top of the screen?
Anyway the other problem I need to fix that you may see in the image is when I set the ScaleType of the GUI to Crop it actually does center the image horizontally, but still not vertically which I’m unsure of how to fix ALSO on this scaletype the image looks crappy and blurry. Now if I change the ScaleType to Slice the image looks right, but now it’s not centered vertically OR horiztonally!
Sorry if my post is long-winded for what is likely a relatively simple problem.