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

how do i make it so that people dont loose there item?

Asked by 4 years ago

this works in the way that the player gets the item and when he/she resets/dies they will get it in there inventory and what doesn't work is that other players when they die the item stays in server storage and its a problem when it leaves the inventory, in general, how would I fix this thank you

01local gamepassid_ = 10022825
02local b = game:GetService("ServerStorage"):FindFirstChild("GravityCoil"):Clone()
03 
04 
05game.Players.PlayerAdded:Connect(function(player)
06    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 10022825) then
07        if player.Backpack:FindFirstChild("GravityCoil") == nil then
08            game.ServerStorage:FindFirstChild("GravityCoil"):Clone()
09            b.Parent = player.Backpack
10        end
11    end
12end)
13 
14 
15    game:GetService('Players').PlayerAdded:Connect(function(player)
View all 31 lines...
0
remove the .Died inside characteradded Subsz 366 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Players have a .StarterGear which holds items that they spawn with. So you could do;

01local gamepassid_ = 10022825
02local b = game:GetService("ServerStorage"):FindFirstChild("GravityCoil"):Clone()
03 
04 
05game.Players.PlayerAdded:Connect(function(player)
06    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 10022825) then
07        if player.Backpack:FindFirstChild("GravityCoil") == nil then
08            game.ServerStorage:FindFirstChild("GravityCoil"):Clone().Parent = player.StarterGear --Adds it to their startergear
09            b.Parent = player.Backpack
10        end
11    end
12end)
Ad

Answer this question