So basically I'm trying to make it so when a player touches a brick it gives them a box..
This is what I have
function onTouch(hit) if 6 > 2 then game.Lighting["Box"]:Clone().Parent = game.Players.LocalPlayer.Backpack wait(15) end end script.Parent.Touched:connect(onTouch)
It only works in test mode and doesn't work in game... I've tried script and local script.
From what I see here it wouldn't ever work in a normal script this way. It calls a LocalPlayer.Backpack which is impossible to call in a normal script.
Your function checks if 6 is bigger than 2 <-- ??, and then assigns the box:Clone() a parent to the local backpack.
From what I can see you want the box to go inside the player's backpack once he hits a certain item.
This is what I recommend:
game.Players.PlayerAdded:connect(function(player) script.Parent.Touched:connect(onTouch) function onTouch(hit) if 6 > 2 then local box = game.Lighting["Box"]:Clone() box.Parent = player.Backpack end end end)