Hello. I'm trying to make a script that changes the ClickDetector's mouse icon when the player hovers on a part that can be clicked, and when they stop hovering on it, it changes back to default.
However, it doesn't work with a table, and I have no idea on how to fix it because I don't really use tables that often.
task.defer(function()
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = 'http://www.roblox.com/asset/?id=9824394203'
local clickDetector = {game.Workspace.Part.ClickDetector, game.Workspace.Part2.ClickDetector}
clickDetector.MouseHoverEnter:Connect(function()
mouse.Icon = 'http://www.roblox.com/asset/?id=4595124035'
print("Cursor Changed!")
end)
clickDetector.MouseHoverLeave:Connect(function()
mouse.Icon = 'http://www.roblox.com/asset/?id=9824394203'
print("Default Cursor.")
end)
end)
The error: attempt to index nil with 'Connect'
