I am trying to make a system that displays a screengui that is inside startergui, whenever your mouse hovers over “CDPart”, it would make a screengui visible.
Here is my code.
repeat wait(3) until game:IsLoaded()
local clickDetector = script.Parent:FindFirstChildOfClass("ClickDetector")
local CDpart = script.Parent
clickDetector.MouseHoverEnter:Connect(function(player)
print("Test")
end)
clickDetector.MouseHoverLeave:Connect(function(player)
print("Test")
end)
I suspect the code is not the problem, as nothing is wrong in input.
Technically, screenGuis can be changed from anywhere. And to the original post you could use the local script, you just needed to copy-paste the code into a server script, and then set the Script.RunContext to Client
repeat wait(1) until game:IsLoaded()
local plr = game.Players.LocalPlayer
local plrGui = plr:WaitForChild('PlayerGui')
wait(1)
local clickDetector = script.Parent.ClickDetector
local CDpart = script.Parent
local CDGui = plrGui.ClickDetector.Frame.TextLabel
local text = CDGui.Text
clickDetector.MouseHoverEnter:Connect(function(player)
print("touching")
text = "Insert tape"
end)
clickDetector.MouseHoverLeave:Connect(function(player)
print("nottouching")
text = " "
end)