Mouse Cursor Issues

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I’m trying to change the mouse’s image to something else, along with disabling it during the opening scene of my game.

  2. What is the issue? The mouse will not disable and the icon will not change, but I don’t know why.

  3. What solutions have you tried so far? I have tried looking on these developer forums and fixing the issue myself, but nothing so far has worked.

To disable the mouse, I’m just using UserInputService.MouseIconEnabled to change it, and for the changing of the icon I am using this code.

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Icon = "rbxassetid://5992580992"

The script to change the icon is local and the script to disable the mouse is server sided, as it is with other code for the opening scene.

I appreciate any help I can get. Please tell me if there’s any extra info you need and I will see if I can give it to you.

2 Likes

There is MouseIconEnabled

There isn’t a full way to completely disable your mouse, you can only make it transparent. See this Doc for how you can do so.

This DevForum article has a similar issue, you can try to replace your current link in your script with the one in that topic.

When I say disable, I just mean to turn it invisible until the opening scene is over. Sorry if that’s confusing.

Alright, well disabling MouseIconEnabled like what @mc7oof and I said should work for helping make the mouse invisible!

I currently have UserInputService.MouseIconEnabled in my script, but when I run the opening scene the mouse does not turn invisible and I’m not sure why.

Can I see what exactly you’re typing in your script?

This is the entire script of the opening scene currently

local DialogueEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("DialogueEvent")
local ToggleDialogueEvent = game.ReplicatedStorage.RemoteEvents:FindFirstChild("ToggleDialogueEvent")
local started = false
local UserInputService = game:GetService("UserInputService")

local TS = game:GetService("TweenService")

local function StartingText()
	game.ReplicatedStorage:WaitForChild("StartingText"):FireAllClients()
	wait(10)
	ToggleDialogueEvent:FireAllClients(true) --toggles dialogue to visible
	DialogueEvent:FireAllClients("Do you") --Dialogue Talking
	wait(7.75)
	DialogueEvent:FireAllClients("remember?")
	wait(10)
	DialogueEvent:FireAllClients("Everything")
	wait(10)
	DialogueEvent:FireAllClients("is GRAY.")
	wait(12.25)
	ToggleDialogueEvent:FireAllClients(false)
	wait(5)
	game.Workspace.BGMusic:Play()
end

game.Players.PlayerAdded:Connect(function(player)
	if started == false then
		started = true
		local screenCover = player.PlayerGui:WaitForChild("DialogueGui").ScreenCover
		screenCover.Visible = true
		UserInputService.MouseIconEnabled = false
		StartingText()
		wait(1)
		local info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
		local tween = TS:Create(screenCover, info, {BackgroundTransparency = 1})
		tween:Play()
		UserInputService.MouseIconEnabled = true
	end
end)

(Sorry if the script itself isn’t super optimized, I’m only a decent coder right now.)

1 Like

You placed both lines of MouseIconEnabled in one event where the Player is added? The game would basically make the mouse transparent, then opaque again?

According to your function for PlayerAdded, it would only wait 1 second for the StartingText, regardless of whether or not it completes, and attempt to tween, before setting the mouse’s MouseIconEnabled to true.

What you should do would be to separate this part of the code:

To a different function, so something like this:

local function TextFinished()
	local info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
	local tween = TS:Create(screenCover, info, {BackgroundTransparency = 1})
	tween:Play()
	UserInputService.MouseIconEnabled = true
end

When the StartingText() function finishes with showing the text, add at the bottom of the function the TextFinished() function.

Sorry, but I’m not quite sure what you mean by this. Are you saying the problem is something with the wait(1) before the tween? Because the tween activates at the right time, which is 1 second after the StartingText() function finishes and starts playing the background music, so I’m not sure why the mouse’s icon wouldn’t do the same.

Oh, sorry about that. They only problem I can think of right now is that:

  • Your script is not a LocalScript.
  • You placed the LocalScript in the Workspace.
1 Like

Oh, it needs to be done in a local script? I was not aware of this. I’ll try to move the mouse code to be local and see if it works.

1 Like

It worked! Now I just need to figure out why the custom icon doesn’t work. Do you think you may know why it doesn’t? (The code for it is in a local script I have put in StarterGui.)

The image might still be under moderation. I attempted to view the image through the ID given, and it seems like you’re using the Asset ID of it already (which is correct!).

1 Like

Alright, I’ll try using a different image or maybe making my own. Thank you so much for the help with this, the opening scene is much better now.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.