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

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

Asked by 6 years ago
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

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question