Tool not showing for other players

Hi,

I made a fridge that can give meals (tools) using a GUi and all. It works, but sadly the other players can’t see me holding the meal.

Local Script in FridgeGUI:

local fridgeGui = script.Parent
local mainFrame = fridgeGui:WaitForChild("MainFrame")
local scrollingFrame = mainFrame:WaitForChild("ScrollingFrame")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local closeButton = mainFrame:WaitForChild("CloseButton")

local meals = {
	{templateName = "MealTemplateBaconEggs", tool = ReplicatedStorage:WaitForChild("Meals"):WaitForChild("BaconEggs")},
	{templateName = "MealTemplateSandwich", tool = ReplicatedStorage:WaitForChild("Meals"):WaitForChild("SandWich")},
	{templateName = "MealTemplatePancakes", tool = ReplicatedStorage:WaitForChild("Meals"):WaitForChild("Pancakes")},
}

local function setupTakeButtons()
	for _, meal in ipairs(meals) do
		local mealFrame = scrollingFrame:WaitForChild(meal.templateName)
		local takeButton = mealFrame:WaitForChild("TakeButton")

		takeButton.MouseButton1Click:Connect(function()
			print("TakeButton clicked for meal:", meal.templateName)
			local player = game.Players.LocalPlayer
			local character = player.Character or player.CharacterAdded:Wait()

			if character then
				local clonedTool = meal.tool:Clone()
				clonedTool.Parent = player.Backpack

				local humanoid = character:FindFirstChildOfClass("Humanoid")
				if humanoid then
					humanoid:EquipTool(clonedTool)
				else
					warn("Humanoid not found in character.")
				end

				fridgeGui.Enabled = false
			else
				warn("Character not found.")
			end
		end)
	end
end

local function setupCloseButton()
	closeButton.MouseButton1Click:Connect(function()
		fridgeGui.Enabled = false
	end)
end

setupTakeButtons()
setupCloseButton()

fridgeGui.Enabled = false

Script in ServerScriptService

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local fridgeEvent = ReplicatedStorage:WaitForChild("FridgeEvent")

local function onPromptEventReceived(player, prompt)
    print("Prompt received from player:", player, "Prompt:", prompt)
    fridgeEvent:FireClient(player) 
end

fridgeEvent.OnServerEvent:Connect(onPromptEventReceived)

Hierarchy of Tool:

image

1 Like

It might be because you’re equipping the item on one client

1 Like

dude, the problem here is that you’re cloning the gear on the LOCAL script and parenting it to the player, so only the player will see it on their client and not the server, so what you need to do is make it so when the player clicks the button to give them a gear, fire a remote event to the server to have a SERVER script give the player the tool, not a local script

2 Likes

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