so say for example you step on a part. You get a GUI that shows up on your screen. But when i tried to do it multiple showed up.
script.Parent.Touched:Connect(function(player) local player = game.Players:GetPlayerFromCharacter(player.Parent) local shop = game.ServerStorage.ScreenGui:Clone() shop.Parent = player:WaitForChild("PlayerGui") -- below here i got no idea what to do end)
ScreenGui
exists in the PlayerGui
, with the Instance:FindFirstChild()
method. If the ScreenGui
was found, we will not do anything. If not, we will clone it so they have it.script.Parent.Touched:Connect(function(part) local player = game.Players:GetPlayerFromCharacter(part.Parent) if player then -- we should make sure it's player first if player.PlayerGui:FindFirstChild("ScreenGui") then return end -- if a ScreenGui was found, do not do anything, just return out the function local shop = game.ServerStorage.ScreenGui:Clone() shop.Parent = player.PlayerGui end end)
Make it so when you touch a part all the rest of the gui's transparency will be 1 except the one you want to show and use the "OnTouchEnded" function to make the guis reappear after the part is not being touched