Hello scripting helpers,
I've just come across an error.
Below this, I have made a GUI cloner when a player spawns or de-spawns.
It checks if the player has a gamepass and if so, clones the gui into the players gui.
I used this on the 4th line:-
game.Players.ChildAdded:connect(function(player)
It only cloned the GUI when a player entered a game and not when she/he respawned.
Here is the full script:-
local clone = game.ServerStorage.ttt:Clone() local id = 213876340 game.Players.ChildAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, id) then print "Player has gamepass" clone.Parent = player.PlayerGui else print "Player doesn't have gamepasss" end end)
Any help? Nathan. :]
Very simply, you need to use the CharacterAdded
Event:
local clone = game.ServerStorage.ttt local id = 213876340 game.Players.ChildAdded:connect(function(player) player.CharacterAdded:connect(function() if game:GetService("GamePassService"):PlayerHasPass(player, id) then print "Player has gamepass" clone:Clone().Parent = player.PlayerGui --You also need to make a clone of the Clone here. else print "Player doesn't have gamepasss" end end) end)