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

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

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)

1 comment

0

Cuz your destroying the parent...

1 answer

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