local plr = game.Players.LocalPlayer
local mouse = player:GetMouse()
local torso = plr:WaitForChild(Torso)
mouse.KeyDown:connect(function(key)
if key == "g" then
local f = Instance.new("Fire",torso)
end
COMMUNITY QUESTION
how to set a torso on fire?
2 answers
I've to found your errors in this script.
local plr = game.Players.LocalPlayer
local mouse = player:GetMouse() -- you need to write it like this:local mouse = plr:GetMouse() because you declare the player as plr.
--You forgot to declare the character because the torso is not in the plr but in the character.
local torso = plr:WaitForChild(Torso) --<-- You need to put it in that -->""
mouse.KeyDown:connect(function(key)--here, you forgot to put an end)
if key == "g" then
local f = Instance.new("Fire",torso)
end
Code fix here:
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local character = plr.CharacterAdded:wait() or workspace[plr.Name]
local torso = character:WaitForChild("Torso")
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "g" then
local f = Instance.new("Fire",torso)
end
end)
Torso is not a direct child of Player. Wait for the character like so:
repeat wait() until plr.Character
Torso = plr.Character:WaitForChild("Torso")
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This gets inserted were..?
It shows you how to get the torso. Insert it wherever it's relevant.