New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Script To Hide 'Open GUI Button' Won't Work Properly?

Asked by 3 months ago
Edited by User#24403 3 months ago

I am making a game and I made some code for it. For some reason, this VIP gamepass script won't work. Please help!

(this is top localscript)

local mps = game:GetService("MarketplaceService")
local gamepass = 6549510
VIP = false

game.Players.PlayerAdded:connect(function(player)
while true do
if mps:UserOwnsGamePassAsync(player.UserId, gamepass) then
VIP = true
end
end
end)


if VIP == true then
--add script here
else
while true do
wait(0.01)
script.Parent.openClose.Visible = false
end
end

(this is bottom localscript)

local mps = game:GetService("MarketplaceService")
local gamepass = 6549510
pparent = script.Parent.Parent
parent = script.Parent
VIP = false

game.Players.PlayerAdded:connect(function(player)
while true do
if mps:UserOwnsGamePassAsync(player.UserId, gamepass) then
VIP = true
else
pparent:Destroy()
end
end
end)

function toggleOpen()
if pparent.main.Visible == false then
pparent.main.Visible = true
parent.Text = "<"
else
pparent.main.Visible = false
parent.Text = ">"
end
end

parent.MouseButton1Down:connect(function()
toggleOpen()
end)

These are the files: https://imgur.com/a/YQzgKzi

Basically, this is meant to make it so that if you do not have the VIP gamepass, it stops the gui from showing on the localplayer's screen. For some reason, even though I own the gamepass, it still doesn't show. Please help!

0
dont put it the gamepass check in a loop Gameplayer365247v2 729 — 3mo
0
change line 14 to if VIP then Gameplayer365247v2 729 — 3mo
0
btw connect is deprecated, instead use Connect Gameplayer365247v2 729 — 3mo
0
still doesn't work gameplayer365247 KingDomas 12 — 3mo
View all comments (3 more)
0
Don't swear nerd!!!!! User#24403 0 — 3mo
0
also i fixed line 30 on localscript 2 KingDomas 12 — 3mo
0
this is my console rn https://imgur.com/a/JtWJXpA KingDomas 12 — 3mo

1 answer

Log in to vote
0
Answered by 3 months ago

change line 14 to if VIP then

Ad

Answer this question