I'm trying to make a GUI pop up when an invisible brick is touched, and lets people of a certain rank through. The rank part works fine, but the GUI script only runs once. I also have MADE SURE the GUI is destroyed in some way, and doesn't stay there out of sight. My code:

local config = script.Parent.Configuration
script.Parent.Touched:connect(function(part)
	if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
		local player = game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
		if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then	
			if not player.PlayerGui:FindFirstChild("MakeGui") then
				script.Parent.MakeGui:Clone().Parent = player.PlayerGui
			end
			script.Parent.CanCollide = false
			wait(.4)
			script.Parent.CanCollide = true
		end
	end
end)

Please help!

2 comments

0

Is the config.RankId.Value being changed at all? also... how / where are you "destroying" the Gui?

0

As long as the GUI is destroyed (which it is), it shouldn't matter. Also, yes. It's at 4, like it should, and if you actually read the post, you would see that everything in the script works fine except the GUI only pops up once.