For Some Reason this script only works once, please someone help me this is very urgent
local touchPart = script.Parent touchPart.Touched:Connect(function(part) local player = game.Players:GetPlayerFromCharacter(part.Parent) if player then player.PlayerGui:WaitForChild("DoubleJumpShop").Frame.Visible = true end end)
I assume you're trying to close the GUI when the player leaves the part. Use the .TouchEnded
event which is the complete opposite of the .Touched
event.
local touchPart = script.Parent touchPart.Touched:Connect(function(part) local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent) if player then player:WaitForChild("PlayerGui"):WaitForChild("DoubleJumpShop").Frame.Visible = true end end) touchPart.TouchEnded:Connect(function(part) local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent) if player then player:WaitForChild("PlayerGui"):WaitForChild("DoubleJumpShop").Frame.Visible = false end end)