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

Help w/ gui in workspace?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

I have a part when you touch it, a gui pops up. I want that gui to go away in 2 seconds ONCE it pops up. I have tryed the script below but the gui does not pop up.

wait(2)
script.Parent:remove()

The script below is the other script to make it appear.

wait(1)
local near = false


local debounce = true
if near == true then
    while wait(0.1) do 
        for i,v in pairs(game.Players:GetChildren()) do 
            if v.Character.Torso ~= nil then 
                if(v.Character.Torso.Position - script.Parent.Position).magnitude < (script.Parent.Size.X /1) + 10 then 
                    if v.PlayerGui:findFirstChild("ExampleGui") ~= nil then return end
                    script.ExampleGui:clone().Parent = v.PlayerGui
                end 
            end 
        end 
    end 
elseif near == false then
    if debounce == true then
        debounce = false
        script.Parent.Touched:connect(function(hit)
            local human = hit.Parent:findFirstChild("Humanoid")
            if (human == nil) then return end
            local player = game.Players:findFirstChild(hit.Parent.Name)
            if (player == nil) then return end
            if player.PlayerGui:findFirstChild("ExampleGui") ~= nil then return end
            script.ExampleGui:clone().Parent = player.PlayerGui
        end)
    debounce = true
    end
end 
1
could we see that script? We need to see that it may not be this part of the script iSvenDerp 233 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

Your script was weird so i made another one for you, if it doesnt work comment the error

gui = guiposition

function touched(obj)
if obj.Parent:FindFirstChild("Humanoid") ~= then
wsplayer = obj.Parent
player = game.Players:FindFirstChild(wsplayer.Name)
if player:FindFirstChild(gui.Name) ~= nil then
clone = gui:Clone()clone.Parent = player.PlayerGui
game:GetService("Debris"):AddItem(clone,2)
end
end
end

script.Parent.Touched:connect(touched)
Ad

Answer this question