Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Tool can not be soon by other players?

Hello, I am working on a game with a friend and he made this script and only your client can see the tool, I am not sure how to fix it and I have asked him a lot to fix it and he wont so I am trying to figure it out myself. The script works 100%, but the tool cannot be seen by other players. Do you have to give the tool to the player on the server? Here's the script:

local Pizzas = {}
local Buttons = {}
local Equipped = nil
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)

local Player = game.Players.LocalPlayer
local Character = Player.Character

local function search(location)
	for i,v in pairs(location:GetChildren()) do
		if v:IsA("Tool") then
			table.insert(Pizzas,v)
		end
	end
end

function update()
	for i,v in pairs(Buttons) do
		v:Destroy()
	end
	for i,v in pairs(Pizzas) do
		local Sample = script.Sample:Clone()
		Sample.Name = v.Name
		Sample.Image = v.TextureId
		Sample.Parent = script.Parent.MainFrame.Handler
		table.insert(Buttons,Sample)
		if Equipped ~= nil and Equipped == v then
			Sample.Equipped.Visible = true
		end
		Sample.MouseButton1Click:connect(function()
			if Equipped == nil or Equipped ~= v then
				Equipped = v
				Character.Humanoid:UnequipTools()
				Character.Humanoid:EquipTool(v)
			else
				Equipped = nil
				Character.Humanoid:UnequipTools()
			end
		end)
	end
end	

function refresh()
	Pizzas = {}
	search(Character)
	search(Player.Backpack)
	update()
end

refresh()

Player.Backpack.ChildAdded:connect(refresh)
Player.Backpack.ChildRemoved:connect(refresh)

Character.ChildAdded:connect(refresh)
Character.ChildRemoved:connect(refresh)

Let me know what is wrong here!

3 comments

0

yes, due to network filtering, you have to give the tool on the server

0

It appears you have used :connect() use :Connect may not help now but in the future... well that will break.

0

Alright, how would I give it on the server? I already know you make a event and fire it, but I'm not sure what to put in that script.

1 answer

The mistake you are most likely making is putting this code in a local script. See, the client will not replicate to the server, so you need to deliver the tool to the player using a server side script. Just telling you right now, with filteringEnabled you are going to have to get use to using Server Scripts, remoteFunctions and Remote Events, and finally, values.

2 comments

0

(Same comment as above lol) Alright, how would I give it on the server? I already know you make a event and fire it, but I'm not sure what to put in that script.

0

I don't know the details. I would help, but I gtg.

This discussion is preserved as it was. New answers, comments, and votes are closed.