I basically made a tool and put it in game.Lighting and I made a script so that only the creator (me) gets it and I don't receive the tool in my backpack but no errors in output
01 | local Players = game:GetService( "Players" ) |
02 |
03 | Players.PlayerAdded:Connect( function (player) |
04 | if player.Name = = "zle_n" then |
05 | local dio = game.Lighting [ "Za Wardo" ] :Clone() |
06 | dio.Parent = game.Players.zle_n.Backpack |
07 | local hi = game.Lighting.Selidus:Clone() |
08 | hi.Parent = game.Players.zle_n.Backpack |
09 | print ( "gave item to owner" ) -- this does print but no item in my backpack |
10 | end |
11 | end ) |
this script should be in ServerScriptService
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | wait( 3 ) |
03 | if player.Name = = "zle_n" then |
04 | local dio = game.Lighting:WaitForChild( "Za Wardo" ):Clone() |
05 | dio.Parent = game.Players.zle_n:FindFirstChild( "Backpack" ) |
06 | local hi = game.Lighting:WaitForChild( "Selidus" ):Clone() |
07 | hi.Parent = game.Players.zle_n:FindFirstChild( "Backpack" ) |
08 | print ( "gave item to owner" ) |
09 | end |
10 | end ) |
The recommendation in the answer above is a bad one. Do not put anything else other than a script in ServerScriptService, if you have tools, put it in ServerStorage. You can put anything in Lighting, but exploiters can get it easily. And your script doesn't seem to have a problem, maybe just have to give it a little wait or use "WaitForChild". Hope this helps.
Everything takes its time to load, so consider using this.
1 | game.Players [ "zle_n" ] :WaitForChild( "Backpack" ) |
Also, lighting isn't where items should go, I recommend a folder in ServerScriptService