- What do you want to achieve?
What I am trying to achieve is so when the player clicks on a part, a UI pops up with the part’s information.
- What is the issue?
The problem is that it only works once. So, basically if one of the parts is clicked for the first time, it appears. But, close out of it and click on it again, it doesn’t work.
- What solutions have you tried so far?
I have tried using local scripts and using the function :GetPropertyChangedSignal so when the text changes, it appears. This method has worked, but the UI didn’t appear when it was clicked on again, on the same part. I looked on the Developer Hub but that didn’t help.
local building = script.Parent
building.ClickDetector.MouseClick:Connect(function(player)
local PlayerGUI = player.PlayerGui
local MenuUI = PlayerGUI.MenuUI
for i, v in pairs(require(game.ReplicatedStorage.Scripts.UtilityAssets)) do
if script.Parent.Name == v[1] and script.Parent.Type.Value == "Electricity" then
MenuUI.PowerStationFrame.Visible = true
end
end
end)