I have a shop. I typed the local script that you can purchased the item. It appears in backpack but why is not working with the starter gear i just want to save the purchased gear when the character died so that is not being repeated the process.This is my local script.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Tools = ReplicatedStorage:WaitForChild("Tools")
local SwordItem = Tools:WaitForChild("SwordToy")
local Buy = script.Parent
local Price = Buy.Parent.Price.Value
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
script.Parent.MouseButton1Click:connect(function()
if stats.Gold.Value >= Price then
stats.Gold.Value = stats.Gold.Value - Price
local cloned = SwordItem:Clone()
local cloned2 = SwordItem:Clone()
cloned.Parent = player:WaitForChild("Backpack")
cloned.Parent = player.StarterGear -- this is line is error
Buy.Text = "Successfully Owned"
end
end)
Can you help me???

1 comment
startergear is a member of game, not player. A version of startergear is Backpack in the player.