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

No idea why this wont work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Trying to give tools to certain players. Tools are in the ServerStorage already. No errors appear or anything, not sure what's wrong.

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:clone().Parent = p.Backpack
MK17:clone().Parent = p.Backpack
EV:clone().Parent = p.Backpack
end
end
end

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function()
onPlayerSpawned(p)
end)
end)
0
Have you tried using ReplicatedStorage instead? funyun 958 — 9y
0
Make sure this is a regular script in Workspace or ServerScriptStorage Goulstem 8144 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)

0
To make your script appear with Lua syntax highlight your text and press the little Lua button on the far right of the options at the top of the answer box Ryzox 220 — 9y
Ad

Answer this question