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

How do I give players items via script?

Asked by
Lopous 1
7 years ago

I have already the gamepass in place, that I ask is that once they have the gamepass, they join in the game with a item, but I want that item be used only once and makes you unkillable for 1 min.

Here's the gamepass script FYI:

gps = game:GetService("GamePassService");

id = script:WaitForChild("GamePassID");
EH = script:WaitForChild("ExtraHealthAmount");


game.Workspace.ChildAdded:connect(function(char)
h=char:FindFirstChild("Humanoid")
if h~=nil then
plr=game.Players:FindFirstChild(char.Name)
if gps:PlayerHasPass(plr, id.Value) then
h.MaxHealth=EH.Value
h.Health=EH.Value
end
end
end)

or is it this one? (still new to scripting)

local productId = 340496291 --My gamepass ID (example, random I choose)
    local player = game.Players.LocalPlayer

    script.Parent.MouseButton1Click:connect(function()
        game:GetService("MarketplaceService"):PromptPurchase(player, productId)
        end) 
0
The second script would be in a GUI to prompt them to purchase something. Overscores 381 — 7y
0
I know that, but how do one simply make them receive an item once they have the gamepass? Lopous 1 — 7y
0
I'm not sure I quite understand what you want? ?? ?? Do you want them to be able to use it once in game or once everytime after you die? Thetacah 712 — 7y
0
A developer product, not a game pass, would be better in the case of your question, because game passes can only be bought once. TheDeadlyPanther 2460 — 7y
0
Just one time use and they can't die for like 1 min, no matter how much damage Input at the lavas Lopous 1 — 7y

Answer this question