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

ClassicSword is not a valid member of ServerStorage?

local players = {"TaTzuto0", "gamingmx2", "Utaeba12"}
local gear = game.ServerStorage.ClassicSword

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(chr)
		for i = 1, #players do
			if players[i] == plr.Name then
				gear:Clone().Parent = plr:WaitForChild("Backpack")
			end
		end
	end)
end)

4 answers

✓ Accepted answer

the sword in ServerStorage isn't loading before your script is running. Be sure to add :WaitForChild() for any objects when referencing them. Also, I would recommend using :GetService() as well. Here's your script but fixed:

local players = {"TaTzuto0", "gamingmx2", "Utaeba12"}
local ServerStorage = game:GetService('ServerStorage')
local gear = ServerStorage:WaitForChild('ClassicSword')

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        for i = 1, #players do
            if players[i] == plr.Name then
                gear:Clone().Parent = plr:WaitForChild("Backpack")
            end
        end
    end)
end)

1 comment

0

why did i get a dislike? lol

make sure the sword is in serverstorage make sure the sword is named right and there are no typos. make sure the script is >serversided. it must be serversided, as localscripts can't access serverstorage.

4 comments

0

Good answer, poor format ecks-dee

0

couldn't find bullet points

0

accept as answer if it worked

0

oml scripting helpers stop spamming

  • Make sure the sword is in ServerStorage
  • Make sure the sword is named right and there aren't any typos.
  • Make sure its a Script not a LocalScript.

it must be ServerSided, as LocalScripts can't access ServerStorage.

1 comment

0

wow....

I don't know. ServerStorage doesn't have the tool in it anymore

Tried it before, doesn't work

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