Hey, Everyone! I have a problem on when I use this script on studio it works but it doesn't when I join a server.
The script is supposed to check if the target player joins the game with a game pass if so it will Tween a GUI away from them, and welcome them to a start screen.
GUI Location: Game.StarterGUI.pAID(ScreenGUI).Frame script location: Workspace.CheckifhasGamepass(Local Script) I have also tried this script with a server script as well...
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)
Replying to a reply quickly would be great, Thanks!
Here's the Local Script
and its Parent
is StarterGui/PlayerGui
local id = 987509977 print("Preparing Function") game:GetService("Players").PlayerAdded:Connect(function(player) print("Using if statment!") if player and game:GetService("GamePassService"):PlayerHasPass(player, id) then print("Accessing frame") local frame = player:FindFirstChild("PlayerGui"):WaitForChild('Paid'):FindFirstChild("Frame") --Assuming script.Parent.Parent was just game.Players.LocalPlayer.PlayerGui print("Tweening frame!") frame:TweenPosition(UDim2.new(0, 0, 5, 0), "In", "Back", 1, true) --You Forgot one more argument, plus why make the time argument to 10??? print("Frame tweened") else print("player or game:GetService("GamePassService"):PlayerHasPass(player, id) is nil/false") end print("Player has joined") end)
I used printing
to debug
the code.
A really bad mistake that you have done is that a local script parent
cannot be in game.Workspace
The only parents
that Local Scripts
would function are at StarterGui/PlayerGui, StarterPlayerScripts, StarterCharacterScripts and ReplicatedFirst
Please submit the answer if it worked!