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

MouseHover over a click detector not working? No output errors?

Yeah just nothing happens thats about it. No output errors either. Is this common, am I missing something? Click detector is in a part which is in a model. The script is also in the part it's a local script. Any help is appreciated here is the code:

local player = game.Players.LocalPlayer
local gui = player.PlayerGui

script.Parent.ClickDetector.MouseHoverEnter:connect(function()
	gui.Identity.Object.Text = "FuseBox"
	gui.Identity.Object.Visible = true
end)

script.Parent.ClickDetector.MouseHoverLeave:connect(function()
	gui.Identity.Object.Visible = false
end)

script.Parent.ClickDetector.MouseClick:connect(function()
	if gui.Task == "Fuse" then
		game.Basement.FuseBox.Sound:Play()
		game.Basement.FuseBox.GLight.Material = "SmoothPlastic"
		game.Basement.FuseBox.RLight.Material = "Neon"
		game.Basement.FuseBox.RLight.Pointlight.Enabled = true
	else
		print("not yet")
	end
end)

1 comment

1

It seems like you have a local script inside of a part, which is probably part of the problem. Put the local script in the StarterGui and just say workspace.Model.Whatever.ClickDetector.

1 answer

✓ Accepted answer

Local Scripts DO NOT work in workspace.

This has been gone over before in this article, and this article.

How to fix this

Place the LocalScript somewhere where it will run, like in StarterPack, and redefine the variables and Instances. We can't just use a regular script because regular scripts can not access GUIs in PlayerGui that it did not create.

Good Luck!

If I helped, please don't forget to accept my answer.

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