Might be simple but I can’t seem to get this. It is supposed to make ui visible when a part is touched. It’s in a local script inside the part being touched. ` local Popup = game.Players.LocalPlayer.PlayerGui.VoucherExchange.etoopen
function onTouch(hit)
if Popup.Visible == false then
Popup.Visible = true
end
end
Put script in part being touched then when part touched, open the ui
local Part = script.Parent
Part.Touched:Connect(function(hit)
local Humnoid = hit.Parent:FindFirstChild("Humanoid")
if Humnoid then
local plr = game.Players:GetPlayerFromCharacter(Humnoid.Parent)
plr.PlayerGui.VoucherExchange.etoopen.Visible = true
end
end)
Though I would suggest you use a proximity prompt or ClickDetector to open the gui rather than .touch
You can just have a LocalScript inside the GUI that listens for a part in workspace to be touched.
local WS = game:GetService("Workspace")
local Part = WS:WaitForChild("Part")
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Name == Player.Name then
if Popup.Visible == false then
Popup.Visible = true
end
end
end
end
Part.Touched:connect(onTouch)