Hi, I'm a novice in scripting, and I am in need of help qq
Right now I am trying to create a script that would only allow certain players in the said script to spawn with these set of tools, so far this is what I got:
if game.Players.LocalPlayer.Name == "kevincatssing" then game.ServerStorage:GetChildren() for i, v in pairs(x) do v:Clone().Parent = game.Players["kevincatssing"].Backpack end end
I am planning to place the script in StarterGui
Please aid qq
I'm assuming that you are using a LocalScript
, because you are accessing the LocalPlayer
. The first Thing I see that is Incorrect is that you are accessing the ServerStorage
through a localscript
, and a localscript can Never access the ServerStorage
, use the ReplicatedStorage instead, you also didn't define what x
is on line 03
, Now lets fix your script.
admin={"kevincatssing"} game.Players.ChildAdded:connect(function(player) -- I'm using the ChildAdded instead of PlayerAdded, because PlayerAdded doesn't work with a localscript if player.Name==admin[1] then local storage=game.ReplicatedStorage:GetChildren() for _,value in pairs(storage) do if value:IsA("Tool") or value:IsA("HopperBin") then -- use the or value:Clone().Parent=player:FindFirstChild("Backpack") end end end end)