#Having problems with tp Prompt

2 messages · Page 1 of 1 (latest)

solar rune
#

Making a teleporter to go from one test game to another, everything is fine sore far other then the Gui. It will show up once when no is pressed it will disappear like it should. The issue comes when I try to step on it again, nothing shows up. How do i fix this?

Local Script for GUI:
local gui = script.Parent
local yesButton = gui.Frame:WaitForChild("YesButton")
local noButton = gui.Frame:WaitForChild("NoButton")
local destinationId = 123456789

gui.Enabled = false

yesButton.MouseButton1Click:Connect(function()
local teleportService = game:GetService("TeleportService")
teleportService:Teleport(destinationId, game.Players.LocalPlayer)
gui.Enabled = false
end)

noButton.MouseButton1Click:Connect(function()
gui.Enabled = false
end)

Teleporter script:
local teleporter = script.Parent

teleporter.Touched:Connect(function(hit)
local character = hit.Parent
if character and character:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(character)
if player then
local playerGui = player:WaitForChild("PlayerGui")
local teleportGui = playerGui:FindFirstChild("TeleportPrompt")
if teleportGui then
teleportGui.Enabled = true
end
end
end
end)

eager river