Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do a make a gui when buying a game pass?

Asked by 7 years ago

Hey, I am kinda a noob at making Lua Scripts on ROBLOX. I have tried to make a local script find if a player has a game pass and if it does the GUI tweens out. Unfortunately, the game keeps coming up with errors for the script. I might be doing something wrong... Here it is

01local id = 987509977
02local frame = script.parent.Parent:WaitForChild('pAID').Frame
03game.Players.PlayerAdded:connect(function(player)
04    if HasPass = Game:GetService("GamePassService"):PlayerHasPass(player, id) then
05 
06    frame:TweenPosition(UDim2.new(0, 0,5, 0,'in', 'Back', 10)
07 
08    )
09end
10end)

Responding to a solution would be grateful :D

1 answer

Log in to vote
0
Answered by 7 years ago

Assuming this is a ServerScript and not a LocalScript, here you go:

1local id = 987509977
2game.Players.PlayerAdded:connect(function(player)
3    if game:GetService("GamePassService"):PlayerHasPass(player, id) then
4        local frame = player.PlayerGui:WaitForChild('pAID').Frame --Assuming script.Parent.Parent was just game.Players.LocalPlayer.PlayerGui
5        frame:TweenPosition(UDim2.new(0, 0, 5, 0), "In", 'Back', 10)
6    end
7end)
0
Hey, This doesn't seem to work online. It does though on studio, why's that? Alanisme124 0 — 7y
0
Are you using a LocalScript or ServerScript? ObscureIllusion 352 — 7y
0
I've tried both. But I'd prefer a local script Alanisme124 0 — 7y
Ad

Answer this question