Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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

Log in to vote
3
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago

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)
0
Can I use a LocalScript from the ServerStorage? Hyperclux 65 — 7y
0
ServerStorage does not replicate to the client. You may use StarterGui, StarterPack, or clone the code directly into the player. Goulstem 8144 — 7y
0
Alright cheers, I'll see what I can do. Hyperclux 65 — 7y
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. Hyperclux 65 — 7y
Ad

Answer this question