Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I wanna clone a gui to playergui in filtering enabled but i cant figure it out. Help?

local sp = script.Parent
local db = true
local Azarth = script.Parent.Option

sp.Touched:connect(function(hit)
	if hit and hit.Parent:findFirstChild("Humanoid") and db then 
		db = false
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if not player.PlayerGui:findFirstChild("Option") then 
			Azarth:Clone().Parent = player.PlayerGui
		
		end
		wait()
		db = true
	end
end)

I have no clue where to put RemoteEvents for this one, it works once but when I reset the GUI wont clone again.

1 answer

Your script must be a Local Script, so this would be the modified code:

sp = script.Parent
db = true
Azarth = script.Parent.Option
player = game.Players.LocalPlayer

sp.Touched:connect(function(hit)
    if hit and hit.Parent:findFirstChild("Humanoid") and db then 
        db = false
        if not player.PlayerGui:findFirstChild("Option") then 
            Azarth:Clone().Parent = player.PlayerGui
        end
        wait()
        db = true
    end
end)

I had begun scripting a year ago graduating from C# and I'm still not used to it, but I believe that that would be your code.

This discussion is preserved as it was. New answers, comments, and votes are closed.