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

i cant clone a tool for some reason?

I am trying to make a player only tool so I have a folder and in that folder, I have a local script and the tool I want to duplicate in the local script is

local player = game.Players.LocalPlayer
local sword = script.Parent.Bird_Destroyer
local clone = sword:Clone()
clone.Parent = player.Backpack
clone.Name = "Bird Destroyer"

the folder rn is in server storage and it doesn't work but if I put it in workspace the tool falls to the ground and if I touch it I pick it up

Edit: So right now I have a local script in starter player scripts saying

local sword = game.ReplicatedStorage.Bird_Destroyer
local clone = sword:Clone()
local toolusers = {"triniti110","cjkizzy286"}
print("somethings wrong")
game.Players.PlayerAdded:Connect(function(player)
	print("player joined")
	for i = 1, #toolusers do
		print("for")
		if toolusers[i] == player.Name then
			print("before cloned")
			clone.Parent = player.Backpack
			clone.Name = "Bird Destroyer"
			print("cloned")
		end
	end
end)

but nothing happens still nor does it print anything but "somethings wrong"

2 comments

0

Change it to a Server Script and place it in ServerScriptService

0

Make sure the tool is not touching the ground, make it hover a little. That solved my problem.

1 answer

ServerStorage as its name says is for Server, you cannot access it with client, it sees nothing inside of it, instead as a storage for client use ReplicatedStorage which is made for that, both client and server can see it.

Ok you better showed that before, now i see the reason, PlayerAdded fires before the code runs, do you want to add the tool to the player? If so then you don't need the PlayerAdded as this script will run when client will somehow load. By your code it seems that you want to add tools to selected players, why don't you use a server script for that instead?

6 comments

0

nope didnt work nothing happened

0

Your local script must be in StarterPlayerScripts or StarterGui or else but not in the tool itself, local scripts cannot run in ReplicatedStorage nor workspace or any other storage

0

still dont work but lemme edit the question to explane

0

yup that explained it

0

im using playeradded because it gives me a player so i can add it the backpack via that

0

so what should i use for player

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