I am scripting a portal, that brings you to another place I have. I got the portal part functional, but I am trying to make it where you need to buy entry to the portal. It gets to "Not enough money" in the output, but It won't turn on visibility to the frame that holds a text that says, "Not enough money" It is on line 49 and 51.
local teleporter = game.Workspace.Trail.Teleporter
local cash = game.ServerScriptService.PlayerCash
local currencyName = "Dollars"
local debounce = false
local unlocked
local StarterGui = game:GetService("StarterGui")
-- purchasing for 50,000 dollars
teleporter.Touched:Connect(function(hit)
print("Hit Detected")
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
print("Human Hit Detected")
local char = hit.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if unlocked == true then
local TeleportService = game:GetService("TeleportService")
local teleporter = game.Workspace.Trail.Teleporter
StarterGui.Teleporting.TeleportingFrame.Visible = true
TeleportService:Teleport(4847090550, player)
else
print("Unlocked doesnt = true detected")
local Yes = StarterGui.Teleporting.Buying.Yes
local No = StarterGui.Teleporting.Buying.No
game.StarterGui.Teleporting.Buying.Visible = true
-- They bought it
Yes.Activated:Connect(function()
if player.leaderstats[currencyName].Value <= 50000 then
player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value - 50000
unlocked = true
StarterGui.Teleporting.Buying.Visible = false
StarterGui.Teleporting.Buying.Active = false
else
local Moneylow = StarterGui.Teleporting.NotEnoughMoney
print("Not enough money detected")
Moneylow.Visible = true
wait(5)
Moneylow.Visible = false
end
end)
No.Activated:Connect(function()
unlocked = false
StarterGui.Buying.Visible = false
StarterGui.Buying.Active = false
end)
end
end
end)
