Don't work with Hide Mouse on the part

if you can try fixed it?

My script:

 local part = script.parent

part.Touched:Connect(function(hit)

local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

local plr = game:GetService("UserInputService").MouseIconEnabled

if plr then
	
	plr = false
end
end)
1 Like

plr has 2 meanings/shortcuts, change the name of one of them to maybe plr2.

What are you trying to accomplish? Do you want your mouse hidden when you point to a specific part?

idk how to make with plr and plr2 can you help me?

i made with Part Touch for no mouse icon is it

Something like

 local part = script.parent

part.Touched:Connect(function(hit)

local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

local plr2 = game:GetService("UserInputService").MouseIconEnabled

if plr then
	
	plr2 = false
end
end)

You can modify it tho.

never work :confused:

maybe if you have another script like tocuh part with hide mouse?

Does it show any error in the Output?

Yes this show the mouse icon never hide…

By Output I meant this:
image
image

1 Like

✓ Possible Solution


Place the local script inside StarterGui


local part = workspace.Part --Location of part

part.Touched:Connect(function(hit)

    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

    local plr = game:GetService("UserInputService")

    if plr.MouseIconEnabled then
	
	    plr.MouseIconEnabled  = false
    end
end)

2 Likes

the most recent plr variable will just end up overriding the previous one. It would just be simpler to rename 1 variable to plr2 and another to plr1.

1 Like

Thank you so much!! this work!! :smiley:

1 Like

Np! Remember there’s a lot of stuff that only works when their in the correct place!

• Script: ServerScriptService

• LocalScript: StarterGui/StarterPlayerScripts

2 Likes

You need to mark his post as the solution if he helped you solve your issue.