Can anyone help?
The problem line is 20.
The line is attempt to index field field 'Character' (a nil value).
Character is defined on line 17.
local player = game.Players.LocalPlayer
This script is a LocalScript in a gun in the Backpack.
Someone help.
This is the full script: http://pastebin.com/m2qHmatb
Add a variable under the player variable like this:
local char = player.Character or player.CharactedAdded:wait()
You can then use that variable for referencing the character, like on line 20:
local torso = char:WaitForChild("Torso") --WaitForChild yields the script until it finds (in this case) Torso in the player's character.
Try adding this to it
local Player = game:GetService'Players'.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait()