Hello everyone, I have problem with probably game pass service or just with Clone(). When player will buy game pass should get items from ReplicatedStorage.PassItems, but i don't know why don't work ;/ If someone can solve it.
Here is script:
pcall(function()
game.Players.PlayerAdded:connect(function(player)
if game.GamePassService:PlayerHasPass(player,298834435) then
local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
cashmoney.Value = cashmoney.Value + 5000
player.CharacterAdded:connect(function(char)
if char:WaitForChild("Humanoid") then
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 25
char.Humanoid.Health = char.Humanoid.Health + 25
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + 8
game.ReplicatedStorage.PassItems.SpeedPotion:Clone().Parent = player.Backpack
end
end)
local msg = Instance.new("Hint",workspace)
msg.Text = player.Name.." joined the game with Ultra V.I.P."
wait(2)
msg:Destroy()
elseif game.GamePassService:PlayerHasPass(player,298833834) then
local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
cashmoney.Value = cashmoney.Value + 200
local msg = Instance.new("Hint",workspace)
msg.Text = player.Name.." joined the game as a V.I.P."
wait(2)
msg:Destroy()
elseif game.GamePassService:PlayerHasPass(player,303658886) then
player.CharacterAdded:connect(function(char)
if char:WaitForChild("Humanoid") then
game.ReplicatedStorage.PassItems.Boombox:Clone().Parent = player.Backpack
end
end)
end
end)
end)

3 comments
I would say it is most likely the fact GamePassService is not a valid member of data model and you would have to use GetService to access the service. Also, for testing purposes I would recommend removing pcall as it will hide errors as well. BlueTaslem will even argue, if your code is good enough you should not even be needing a protection call.
I don't know why people downgrading it 0_0 probably kids got 25+ Reputation and giving it to everyone ;s and yeah i thought about GetService, so i'll try it.
I changed it and still can't receive items ;/