I’m wanting to clone a tool from serverstorage and parent it to the player backpack. The problem is, when I press the button GUI that has a local script, the output says Wood is not a valid member of ServerStorage "ServerStorage" - Client - BuyScript:11
My script:
local Player = game.Players.LocalPlayer
local button = script.Parent
local SS = game:GetService("ServerStorage")
button.MouseButton1Click:Connect(function()
local backpack = Player:WaitForChild("Backpack")
if backpack then
print("Found Player Backpack")
local woodCheck = backpack:FindFirstChild("Wood")
if woodCheck then
local stoneClone = SS.Stone:Clone()
stoneClone.Parent = backpack
print("Found Wood and gave stone")
else
print("No wood")
end
end
end)
Server storage contents cannot be accessed from the client. You also shouldnt get tools from the client because they won’t replicate (“exist”) on the server, and you would run into errors when indexing the tool. Better use a RemoteEvent to do the tool adding job, but you’ll have to add some checks for security