So if the player touches a certain part, a GUI within that part will show up. This works fine, but the GUI will clone and overlap itself many times when I only want one of it. I tried adding debounce but then it somehow only works once, and wont show up again if the player restarts. (I use FE btw) How can I fix this problem?
local menu = script.Parent.Animations 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)
I may be wrong, but from what I can see, it's just the fact you placed the wrong name of the GUI.
local menu = script.Parent.Animations 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)
The menu variable shows that the GUI is named 'Animations', but you're checking for a GUI named 'menu'.
Therefore, you should just change the line to if not player.PlayerGui:FindFirstChild("Animations") then
.
I apologise in advance if I got this wrong.