Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do i make a gui pop up when i touch a brick?

Asked by 7 years ago
Edited 7 years ago

and also, if applicable, how could multiple guis pop up when a brick is touched?

script.Parent.Touched:connect(function (hit)
if hit.Parent and game.Players:FindFirstChild(hit.Parent.Name) then
Play = game.Players[hit.Parent.Name]
if Play:FindFirstChild("PlayerGui") and not Play.PlayerGui:FindFirstChild(GUI.Name) then
GUI:Clone().Parent = Play.PlayerGui
end
end
end)

it is going to be for a shop gui, so once you touch the shop, a menu would pop up where you can buy items, i just want the gui popping up done also, the screenguis name is ShopGui1

0
This code doesn't work for you? It looks fine to me. Mayk728 855 — 7y
0
it doesn't work for me :/ NinjaCall456 13 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You could do this.

local Part = script.Parent

Part.Touched:connect(function(HIT)
    local H = HIT.Parent:FindFirstChild("Humanoid")
    if H then
            local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
            Player.PlayerGui.GUINAME.Frame.Visible = true
    end
end) 


Place it inside a brick. And change "GUINAME.Frame" to Where the gui you want to show is located, I'm sure you can figure out how to modify this.

0
it doesn't seem to work for me, does it also work with unions? NinjaCall456 13 — 7y
0
Send me your entire code and I can try to help you! :) GuestRealization 102 — 7y
0
haha apparently the visible tab was checked off, thanks! NinjaCall456 13 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

does this work?


script.Parent.Touched:connect(function(hit) if(hit ~= nil)then if(hit.Parent:FindFirstChild("Humanoid") ~= nil)then local player = game.Players:GetPlayerFromCharacter(hit.Parent) workspace.Shop.ScreenGui:Clone().Parent = player:FindFirstChild("PlayerGui") end end end)
0
i forgot to mention mine has to have a model called Shop in the workspace and the gui needs to be in shop orionater 0 — 7y

Answer this question