If you step on a certain part, it will transfer a ScreenGui into the PlayerGui. It works fine, but it causes about 5 other clones of that same Gui to show up as well. It can be pretty messy, so I'd like to fix it. There are no error messages, and I use FilteringEnabled.
local menu = script.Parent.CharacterGui
local function onTouched(hit)
if (game.Players:GetPlayerFromCharacter(hit.Parent)) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player.PlayerGui:findFirstChild("menu") then
menu:Clone().Parent = player.PlayerGui
wait()
end
end
end
script.Parent.Touched:connect(onTouched)

4 comments
you should just have the gui in the playergui already and update a couple of things depending on the touch button
I suppose that could be an option. I'll give it a try, thanks for the idea.
._. Do you even frickin read the answers you are given.
Yes. They didn't help and I figured it out on my own.