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

Doesn't give tool on respawn, can someone please help?

Asked by 10 years ago

This doesn't give the tool on respawn. Help, please?

Also, half the time it doesn't even load the sword at all unless I respawn my character since I already have the gamepass, but if someone buys the gamepass from ingame, it doesn't give them it on respawn. It's weird and I don't get it.

wait(2) 

GamepassID = 162597573
Tools = {"Dual Darkheart"}

GPS = Game:GetService("GamePassService")
function respawned(char)
    player = game.Players:FindFirstChild(char.Name)
    if char:FindFirstChild("Head") ~= nil then
        if GPS:PlayerHasPass(player, GamepassID) then
            for i = 1,#Tools do
                game.ServerStorage:FindFirstChild(Tools[i]):Clone().Parent = player.Backpack
            end
        else
        end
    end
end

game.Workspace.ChildAdded:connect(respawned)
0
Well, if they buy in-game they need to be in a new server for it to work Tempestatem 884 — 10y
0
Not always.. Pawsability 65 — 10y

1 answer

Log in to vote
0
Answered by
x1op 0
10 years ago
game.Workspace.ChildAdded:connect(function(char)
if game.Players:GetPlayerFromCharacter(char)~=nil then
if game:GetService("GamePassService"):PlayerHasPass(162597573,game.Players:GetPlayerFromCharacter(char)) then
game:GetService("InsertService"):LoadAsset(108149175).Parent = game.Players:GetPlayerFromCharacter(char).Backpack
end
end
end)
Ad

Answer this question