so i’m making a shop system but for some reason when i parent the tool to player backpack it just breaks, it works perfectly fine when i put parent to starterPack but i don’t want player to reset just to get a tool
Client:
wait(game.Loaded)
--//Services
local Tween_Service = game:GetService("TweenService")
local Replicated_Storage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
--//Tools
local Tools_Folder = Replicated_Storage.Tools
--//Gui
local BackGround = script.Parent.Screen.BackGround
local Shop_Frame = BackGround.ShopFrame
local Information_Frame = BackGround.InformationFrame
local Close_Button = BackGround.CloseButton
local Tool_buy_Button = Information_Frame.ToolBuyButton
local Tool_Image = Information_Frame.Tool_Image
local Tool_Name_Text = Information_Frame.ToolName
local Tool_Description_Text = Information_Frame.ToolDescription
local Better_FlashLight_Gui = Shop_Frame.Better_FlashLight
--//Player
local player = game.Players.LocalPlayer
local Character = player.Character
local Humanoid = Character.Humanoid
--//Currency
local Points = player:WaitForChild("Points")
--//Tables
local Description_Table =
{"Advanced FlashLight, Better than your old one huh?",
}
--//Tween_Services
--//Functions//
local function buying()
local tool = Tools_Folder:FindFirstChild(Tool_Name_Text.Text)
if tool and tool.Cost then
if Points.Value > tool.Cost.Value then
script.Tool_Buying_remote:FireServer(tool)
Points.Value -= tool.Cost.Value
else
print(player.Name.." Doesn't have enough points")
end
end
end
local function Close_Gui()
script.Parent.Enabled = false
end
local function FlashLight_Check_Button()
Tool_Name_Text.Text = "Advanced FlashLight"
Tool_Description_Text.Text = Description_Table[1]
end
--//Running Functions
Better_FlashLight_Gui.Check_Button.MouseButton1Click:Connect(FlashLight_Check_Button)
Tool_buy_Button.MouseButton1Click:Connect(buying)
Close_Button.MouseButton1Click:Connect(Close_Gui)
server:
script.Parent.Tool_Buying_remote.OnServerEvent:Connect(function(player, tool)
local tool_Clone = tool:Clone()
tool_Clone.Name = "Advanced FlashLight"
tool.Parent = game.StarterPack
end)