Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Why if player has gamepass he can't receive item from lighting?

Asked by 8 years ago

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)
0
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. M39a9am3R 3210 — 8y
0
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. DevKarolus1 70 — 8y
0
I changed it and still can't receive items ;/ DevKarolus1 70 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

In Line 11 you put :Clone().Paren = player.Backpackinstead of :Clone().Parent = player.Backpack.

0
No, that got cut off somehow in the formatting process. If you look at the raw text, the full word is present. DigitalVeer 1473 — 8y
Ad
Log in to vote
-2
Answered by
lukeb50 631 Moderation Voter
8 years ago

try setting line 03 to:

game:GetService("MarketplaceService"):PlayerOwnsAsset(player,id)

change the id to the id(too lazy to look at the script)

also, i would recommend not using Lighting and switching to a different storage

tell me if this works

0
anyone mind telling me why they are downvoting this? lukeb50 631 — 8y
0
I'm using ReplicatedStorage, so i don't where you read Lighting... And it's wrong, becouse i need to use GamePassService ;s DevKarolus1 70 — 8y

Answer this question