Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Custom cursor works in a SP test world, but not in a MP one. What am I doing wrong?

This seem to work perfectly when I play in a test world, however; it does not work at all when I am testing the server with multiple people. What am I doing wrong?

Script in Workspace

--Normal script

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

--Change the cursor when hovering over an object
script.Parent.MouseHoverEnter:connect(function(player)
	mouse.Icon = "http://www.roblox.com/asset/?id=652181258"
	
end)

--Change the cursor when leaving the object
script.Parent.MouseHoverLeave:connect(function(player)
	mouse.Icon = "http://www.roblox.com/asset/?id=652178724"
end)

Localscript in StarterGui

--Localscript in StarterGui > ScreenGui
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = "http://www.roblox.com/asset/?id=652178724"

1 answer

You cannot access the Mouse object from the server. Execute all your code on the client for this to work.

--Localscript

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

--Change the cursor when hovering over an object
script.Parent.MouseHoverEnter:connect(function(player)
	mouse.Icon = "http://www.roblox.com/asset/?id=652181258"
end)

--Change the cursor when leaving the object
script.Parent.MouseHoverLeave:connect(function(player)
	mouse.Icon = "http://www.roblox.com/asset/?id=652178724"
end)

4 comments

0

Can I use a LocalScript from the ServerStorage?

0

ServerStorage does not replicate to the client. You may use StarterGui, StarterPack, or clone the code directly into the player.

0

Alright cheers, I'll see what I can do.

0

I changed the script to a LocalScript, I also moved it to StarterGui, however; I still have the same problem. I changed the code a whole lot though http://pastebin.com/Y4tgQ1E8.

This discussion is preserved as it was. New answers, comments, and votes are closed.