Trying to give tools to certain players. Tools are in the ServerStorage already. No errors appear or anything, not sure what's wrong.
01 | Allowed = { "Player" } |
02 |
03 | local MK 48 = game.ServerStorage [ "Mk-48" ] |
04 | local MK 17 = game.ServerStorage [ "Mk-17" ] |
05 | local EV = game.ServerStorage [ "Explosive vest" ] |
06 |
07 | function onPlayerSpawned(p) |
08 | for _,v in pairs (Allowed) do |
09 | if p.Name:lower() = = v:lower() then |
10 | MK 48 :clone().Parent = p.Backpack |
11 | MK 17 :clone().Parent = p.Backpack |
12 | EV:clone().Parent = p.Backpack |
13 | end |
14 | end |
15 | end |
Allowed = {"Player"}
local MK48 = game.ServerStorage["Mk-48"] local MK17 = game.ServerStorage["Mk-17"] local EV = game.ServerStorage["Explosive vest"]
function onPlayerSpawned(p) for _,v in pairs(Allowed) do if p.Name:lower() == v:lower() then MK48 = MK48:clone() MK48.Parent = p.Backpack MK17 = MK17:clone() MK17.Parent = p.Backpack EV = EV:clone() EV.Parent = p.Backpack end end end
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function() onPlayerSpawned(p) end) end)