local Id = 11260362
local VipPlayers = {"ihab123432gamer", "eleutherios", "Erik199875", "iiTHECOOLZ", "flyerbram002", "TrulyRev", "MrCrutuBringer"}
local GUIName = {"VSS"}
local GUIName2 = {"SVD"}
local function FindPlayer(Plr)
for Num, Pler in pairs(VipPlayers) do
if Pler == Plr then
return true
end
end
end
game.Players.PlayerAdded:connect(function(Player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, Id) or FindPlayer(Player.Name) then
Player.CharacterAdded:Connect(function(character)
for Num, TextButton in pairs(GUIName) do
if game:GetService("ServerStorage"):FindFirstChild(TextButton) then
game:GetService("ServerStorage")[TextButton]:Clone().Parent = Player.PlayerGui.pickweap:WaitForChild("Main")
end
end
end)
for Num, TextButton in pairs(GUIName) do
if Player.Backpack:FindFirstChild(TextButton) == nil then
if game:GetService("ServerStorage"):FindFirstChild(TextButton) then
game:GetService("ServerStorage")[TextButton]:Clone().Parent = Player.PlayerGui.pickweap:WaitForChild("Main")
end
end
end
end
end)
game.Players.PlayerAdded:connect(function(Player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, Id) or FindPlayer(Player.Name) then
Player.CharacterAdded:Connect(function(character)
for Num, TextButton in pairs(GUIName2) do
if game:GetService("ServerStorage"):FindFirstChild(TextButton) then
game:GetService("ServerStorage")[TextButton]:Clone().Parent = Player.PlayerGui.pickweap:WaitForChild("Main")
end
end
end)
for Num, TextButton in pairs(GUIName2) do
if Player.Backpack:FindFirstChild(TextButton) == nil then
if game:GetService("ServerStorage"):FindFirstChild(TextButton) then
game:GetService("ServerStorage")[TextButton]:Clone().Parent = Player.PlayerGui.pickweap:WaitForChild("Main")
end
end
end
end
end)
this script in ServerScriptService gives players with a gamepass a gui button when they join. However, it stops working when hey die, which also breaks the other scripts I have. How do I get this to look or reset every time the player dies?
Should I switch to a local script instead?
