Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

Responding to a solution would be grateful :D

1 answer

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

local id = 987509977
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
		local frame = player.PlayerGui:WaitForChild('pAID').Frame --Assuming script.Parent.Parent was just game.Players.LocalPlayer.PlayerGui
		frame:TweenPosition(UDim2.new(0, 0, 5, 0), "In", 'Back', 10)
	end
end)


3 comments

0

Hey, This doesn't seem to work online. It does though on studio, why's that?

0

Are you using a LocalScript or ServerScript?

0

I've tried both. But I'd prefer a local script

This discussion is preserved as it was. New answers, comments, and votes are closed.