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

Help w/ gui in workspace?

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 comment

1

could we see that script? We need to see that it may not be this part of the script

1 answer

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)

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