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

Restricted tool giver not working? Help!

So, I have this tool giver that gives tools to certain players only. I need help, I don't know what to do!

local ToolNames = {"Bat", "Flashbang", "Glock17", "Baton"} 
local Storage = game:GetService("ServerStorage")


local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")

ClickDetector.MouseClick:connect(function(Player)
	if plr.Name == "djwchon" or "MimikwMamako" then
		local Backpack = Player:WaitForChild("Backpack")
		for i = 1, #ToolNames do
			local Tool = Storage:FindFirstChild(ToolNames[i])
			if Tool then
				Tool:clone().Parent = Backpack
			end
		end
	end
end

2 comments

0

Fix your code brackets.

0

Fixed

1 answer

✓ Accepted answer

On line 9, plr is undefined as you defined the parameter as "Player". Simply change plr to Player and you're set.

2 comments

0

Didn't work :(

0

wait nvm it worked

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