These 2 scripts are working completely differently while being almost the same? They work the same with the same leaderstat but when the leaderstat is changed one doesn't work?
gamepass script - VIP
local MS = game:GetService("MarketplaceService")
local VIPID = 7187215
local VIPID1 = 7208245
local RS = game:GetService("ReplicatedStorage")
local billboardgui = game:GetService("ServerStorage"):WaitForChild("VIP")
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if MS:UserOwnsGamePassAsync(Player.UserId,VIPID) or MS:UserOwnsGamePassAsync(Player.UserId,VIPID1) then
game.ReplicatedStorage.RemoteEvents:WaitForChild("VIPTTRE"):FireClient(Player)
local clonedgui = billboardgui:Clone()
clonedgui.TextLabel.Text = "VIP"
clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
clonedgui.Parent = game.Workspace:WaitForChild(Player.Name).Head
Player.leaderstats1.Purchases1.Value = 2
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
-- Here tag.Value is the player who killed us, so find their leaderstats
local killersLeaderstats = tag.Value:FindFirstChild("leaderstats")
if killersLeaderstats then
-- Award the cash to the player that killed us
killersLeaderstats.Money.Value = killersLeaderstats.Money.Value + 5
end
end
end
end)
end)
end)
end
end)
end)
Gamepass script - MVP
local MS = game:GetService("MarketplaceService")
local VIPID1 = 7208245
local RS = game:GetService("ReplicatedStorage")
local billboardgui = game:GetService("ServerStorage"):WaitForChild("VIP")
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if MS:UserOwnsGamePassAsync(Player.UserId,VIPID1) then
wait(1)
local VIP = game.Workspace:WaitForChild(Player.Name).Head:FindFirstChild("VIP")
VIP.TextLabel.Text = "MVP"
VIP.TextLabel.TextColor3 = Color3.fromRGB(0, 255, 255)
if not VIP then
local clonedgui = billboardgui:Clone()
clonedgui.TextLabel.Text = "MVP"
clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0, 255, 255)
clonedgui.Parent = game.Workspace:WaitForChild(Player.Name).Head
Player.leaderstats1.Purchases2.Value = 3
end
end
end)
end)
LocalScript inside button for MVP - Working
local purchases = game.Players.LocalPlayer.leaderstats1.Purchases2
game.Players.LocalPlayer:WaitForChild("leaderstats1")
purchases.Changed:Connect(function()
if purchases.Value == 3 then
print("MVP")
script.Parent.Visible = true
script.Parent.Parent.MVP1.TextLabel.Visible = false
else
print("Bye")
script.Parent.Visible = false
end
end)
Local Script inside button for VIP - Not Working
local purchases = game.Players.LocalPlayer.leaderstats1.Purchases1
game.Players.LocalPlayer:WaitForChild("leaderstats1")
purchases.Changed:Connect(function()
if purchases.Value == 2 then
print("VIP")
script.Parent.Visible = true
script.Parent.Parent.VIP1.TextLabel.Visible = false
else
print("Bye")
script.Parent.Visible = false
end
end)
Right, sorry that was a lot of scripts, I would love it if someone could help!

1 comment
That doesn't work