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)