Backpack updates not showing server side

So this is a Local Script in StarterGUI
but my issue is whenever I parent a new tool to the player, only THEY can see it, and to everyone else there just holding nothing. I have the paint buckets (the things I’m trying to give to the player) in a folder in the workspace,

here is the area where it parents the tool to the player,

		-- Clone the CPaintBucket tool and place it in the player's backpack
		local TargetPaintBucket = game.Workspace.Tools.CPaintBucket
		local toolClone = TargetPaintBucket:Clone()
		toolClone.Parent = backpack
		print("Backpack emptied and bucket cloned!")

and here is the full script if you need it which I doubt,

local button = script.Parent 



local function isButtonGreen()
	if button:IsA("GuiButton") then
		local buttonColor = button.BackgroundColor3
		local greenThreshold = 0.5 

		-- Check if the green component of the color is above the threshold
		return buttonColor.g > greenThreshold
	else
		warn("Button not found or is not a GuiButton.")
		return false
	end
end

button.MouseButton1Click:Connect(function()
	if isButtonGreen() then
		
		-- Remove whatever the player is holding
		local player = game.Players.LocalPlayer
		local backpack = player.Backpack

		-- Check if the player is holding a tool
		local currentTool = player.Character and player.Character:FindFirstChildOfClass("Tool")
		if currentTool then
			currentTool:Destroy()
		end
		-- Empty the player's backpack
		local player = game.Players.LocalPlayer
		local backpack = player.Backpack

		for _, item in pairs(backpack:GetChildren()) do
			item:Destroy()
		end
		
		local function deleteSelectionObjects(playerName)
			local character = game.Workspace:FindFirstChild(playerName)
			if character then
				for _, obj in pairs(character:GetDescendants()) do
					if obj.Name == "SelectionBox" or obj.Name == "SelectionPartLasso" then
						obj:Destroy()
					end
				end
			end
		end

		local playerName = player.Name

		-- Delete from the current character in Workspace
		deleteSelectionObjects(playerName)

		-- Clone the CPaintBucket tool and place it in the player's backpack
		local TargetPaintBucket = game.Workspace.Tools.CPaintBucket
		local toolClone = TargetPaintBucket:Clone()
		toolClone.Parent = backpack
		print("Backpack emptied and bucket cloned!")
	else
		print("Button is not green - Nil")
	end
end)

It is not supposed to show in server.
[https://devforum.roblox.com/t/understanding-the-difference-between-server-side-and-client-side/2589383](Understanding the difference between client and server)
to my extent of knowledge, you can place a simple server script in starter gui and just count the parents to get the player.

1 Like

This is because client scripts run on that specific player. Parts influenced by a local script will not replicate to the server. You can communicate with the server by using remote events in order to show the object to all players

so your saying, whenever they get a paint bucket on the local script, fire a remote server event, that triggers them to get a paint bucket also on the server-side?

No, the line if currentTool then currentTool:Destroy() end should be on a server script which you can achieve using a remote event. Replace that with something like remote:FireServer(currentTool) for example. I recommend watching a tutorial on client sided stuff and server sided stuff. Great video for remote events and wth is a local script

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.