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

Give LIghting Gear script?

So I tried to make a Simple give script so when you say give/NC nc is a gear in lighting and I cant get it to do that... Can you guys help?

game.Players.PlayerAdded:connect(function(plyr)
	if plyr == "narfh" then
		plyr.Chatted:connect(function(chatmessage)
			local command = {"give/NC"}
			_, _, filter, receiver, gift = string.find(chatmessage, "(give/)(%w*/)(%w*)")
			table.insert(command, filter); table.insert(command, receiver); table.insert(command, gift)
			if #command == 3 and command[1] == "give/" then
				local player = command[2]:sub(1, (command[2]:len() - 1))
				local tool = command[3]
				if game.Players:FindFirstChild(player) and game.Lighting:FindFirstChild(tool) then
					game.Lighting[tool]:Clone().Parent = game.Players[player].Backpack
				end
			end
		end)
	end
end)

1 comment

0

In codeBlock please

1 answer

✓ Accepted answer

You need to put that code in a code block, but I did notice a problem right off the bat. You said

if plyr == "narfh"

but a Player will never, ever equal a string. It is its own object. You probably meant to get the player's name.

if plyr.Name == "narfh"

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