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

A player steps on part, GUI appears but not for a second time why?

Asked by
Vxpper 101
4 years ago

I'm making a game where a player steps on a pad and it brings down a GUI code here:

function onTouch(part)
    local humanoid = part.Parent:FindFirstChild("Humanoid")
    if (humanoid ~= nil) then -- if a humanoid exists, then
    local p = game.Players:FindFirstChild(part.Parent.Name)
    if p ~=nil then
    p.PlayerGui.MainGui.PetandTrail:TweenPosition(UDim2.new(0.5, -350, -0.5, -250), "Out", "Bounce", 1, false, nil) -- move the frame
        end
    end
end

script.Parent.Touched:connect(onTouch)

but, when the player closes out of the GUI, it doesn't open again, why is this?

code for closing the GUI:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Open.Value = false
    script.Parent.Parent.Parent.Parent.PetandTrail:TweenPosition(UDim2.new(0.5, -350, -0.5, -1500),"Out","Bounce",1,true)
end)
0
Cuz your destroying the parent... mart8888888 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

cuz your destroying the parent.

Ad

Answer this question