Hi!
I have a Custom Cursor script, and it wont change half the time.
What am I doing wrong?
Thanks!
-- CursorScriptv1.2
--[[
CURSOR V1.2
-Made smoother
- broke the fact it changes lol
-What else do you expect, this is a cursor script!
]]
local plr = game.Players.LocalPlayer
local runService = game:GetService("RunService")
local userInput = game:GetService("UserInputService")
local mouse = plr:GetMouse()
local mouseFr = script.Parent
local printDebug = false
-- Functions --
function toggleNewMouse(enabled)
if enabled then
mouseFr.Visible = false
mouse.Icon = "rbxasset://Cursors/KeyboardMouse/ArrowFarCursor.png"
userInput.MouseIconEnabled = true
else
mouseFr.Visible = true
mouse.Icon = ""
userInput.MouseIconEnabled = false
end
end
function updateMouse(x, y)
mouseFr.Position = UDim2.new(0, x, 0, y)
if printDebug then
print("Updated mouseFr position to " .. tostring(x) .. ", " .. tostring(y))
end
end
function connectEvents(guiObject)
if guiObject:IsA("GuiObject") then
guiObject.MouseEnter:Connect(function()
if guiObject.Visible == true then
if guiObject.Transparency ~= 1 then
mouseFr.Image = "http://www.roblox.com/asset/?id=7027845989"
end
else
mouseFr.Image = "http://www.roblox.com/asset/?id=7027810711"
end
end)
guiObject.MouseLeave:Connect(function()
mouseFr.Image = "http://www.roblox.com/asset/?id=7027810711"
end)
end
end
-- Main Logic --
toggleNewMouse(false)
plr.PlayerGui.DescendantAdded:Connect(connectEvents)
for _, descendant in pairs(plr.PlayerGui:GetDescendants()) do
connectEvents(descendant)
end
runService.Stepped:Connect(function()
updateMouse(mouse.X - 32, mouse.Y + 4) -- we negate 32 from X and add 4 to Y so the position for mouseFr is accurate
end)
Video:
Thanks for any help!