1 | local plr = game.Players.LocalPlayer |
2 | local mouse = player:GetMouse() |
3 | local torso = plr:WaitForChild(Torso) |
4 |
5 |
6 | mouse.KeyDown:connect( function (key) |
7 | if key = = "g" then |
8 | local f = Instance.new( "Fire" ,torso) |
9 | end |
I've to found your errors in this script.
01 | local plr = game.Players.LocalPlayer |
02 | local mouse = player:GetMouse() -- you need to write it like this:local mouse = plr:GetMouse() because you declare the player as plr. |
03 | --You forgot to declare the character because the torso is not in the plr but in the character. |
04 | local torso = plr:WaitForChild(Torso) --<-- You need to put it in that -->"" |
05 |
06 |
07 | mouse.KeyDown:connect( function (key) --here, you forgot to put an end) |
08 | if key = = "g" then |
09 | local f = Instance.new( "Fire" ,torso) |
10 | end |
Code fix here:
01 | local plr = game.Players.LocalPlayer |
02 | local mouse = plr:GetMouse() |
03 | local character = plr.CharacterAdded:wait() or workspace [ plr.Name ] |
04 | local torso = character:WaitForChild( "Torso" ) |
05 |
06 |
07 | mouse.KeyDown:connect( function (key) |
08 | key = key:lower() |
09 | if key = = "g" then |
10 | local f = Instance.new( "Fire" ,torso) |
11 | end |
12 | end ) |
Torso is not a direct child of Player. Wait for the character like so:
1 | repeat wait() until plr.Character |
2 | Torso = plr.Character:WaitForChild( "Torso" ) |