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

 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

Log in to vote
0
Answered by 7 years ago

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)


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