Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Restricted tool giver not working? Help!

Asked by
djwchon 10
3 years ago
Edited 3 years ago

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
0
Fix your code brackets. DinozCreates 1070 — 3y
0
Fixed djwchon 10 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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

0
Didn't work :( djwchon 10 — 3y
0
wait nvm it worked djwchon 10 — 3y
Ad

Answer this question