KeyBind results in unable to find specified part in Character

When I check my output, it says that it is Unable to find “UpperTorso” in my Player. Can anybody solve this?

local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()



mouse.KeyDown:connect(function(key)
	if key == "z" then
player.Character.UpperTorso = Instance.new("Explosion")
	end
end)

The problem is coming from the fact that you are setting their UpperTorso equal to an Explosion. What exactly are you trying to do?

Trying to make it so an explosion happens in the desired Player’s UpperTorso.

Try this. You want to set the position to the Upper Torso’s position

mouse.KeyDown:connect(function(key)
	if key == "z" then
            local explosion = Instance.new("Explosion")
            explosion.Position = player.Character.UpperTorso.Position
            explosion.Parent = game.Workspace
	end
end)

Cheers mate!
Thanks for the help.

1 Like