я пытаюсь телепортироваться в другое место, если у него нет геймплея
но это не работает!
у меня есть
как родители
Текстовая кнопка -> localscript -> screengui -> Startergui
это мой код:
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = game:GetService("Player")
local gamePassID = 6180124 -- Change this to your game pass ID
local hasPass = false
local TeleportService = game:GetService("TeleportService")
-- Check if the player already owns the game pass
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
end)
-- If there's an error, issue a warning and exit the function
if not success then
return
end
if hasPass == true then
local Gui = script.Parent.Parent
local Window = Gui:WaitForChild("Frame")
Window.Visible = false
end
if hasPass == false then
game:GetService("TeleportService"):Teleport(3043589235)
TeleportService:Teleport(3043589235, player)
end
---now onclick
script.Parent.MouseButton1Click:connect(function()
-- Check if the player already owns the game pass
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
end)
-- If there's an error, issue a warning and exit the function
if not success then
return
end
if hasPass == true then
print("HasPass")
local Gui = script.Parent.Parent
local Window = Gui:WaitForChild("Frame")
Window.Visible = false
end
if hasPass == false then
game:GetService("TeleportService"):Teleport(3043589235)
TeleportService:Teleport(3043589235, player)
end
end)
Я хочу телепортировать его обратно, если у него нет игрового прохода.
если я нажму на кнопку или подожду. Ничего не произошло.
что не так?