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

Gui only pops up only once in a touch-fired script?

Asked by 5 years ago

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:

01local config = script.Parent.Configuration
02script.Parent.Touched:connect(function(part)
03    if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
04        local player = game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
05        if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then 
06            if not player.PlayerGui:FindFirstChild("MakeGui") then
07                script.Parent.MakeGui:Clone().Parent = player.PlayerGui
08            end
09            script.Parent.CanCollide = false
10            wait(.4)
11            script.Parent.CanCollide = true
12        end
13    end
14end)

Please help!

0
Is the config.RankId.Value being changed at all? also... how / where are you "destroying" the Gui? SerpentineKing 3885 — 5y
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. ethersend 38 — 5y

Answer this question