local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = Character:WaitForChild("Torso") or Character:FindFirstChild("UpperTorso")
I made sure the avatar settings for the game is R6.
Fairly certain you’d have to make a custom function for that, haven’t tested it but it’s pretty self-explanatory:
local function waitForFirstChild(parent, name1, name2)
local initialTick, child = tick(), nil
repeat
child = parent:FindFirstChild(name1) or parent:FindFirstChild(name2)
if tick() - initialTick > 5 and not child then
warn('Infinite yield possible on',parent:GetFullName())
end
if not child then
task.wait()
end
until child
return child
end
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = waitForFirstChild(Character, 'Torso', 'UpperTorso')
I see, I think it had to do with the scope of your functions. Try putting everything that doesn’t belong to a function inside of your tool.Equipped function:
Tool.Equipped:connect(function(TempMouse)
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = waitForFirstChild(Character, 'Torso', 'UpperTorso')
-- etc
local players = game:GetService('Players')
local player = players.LocalPlayer
local character
local humanoid
local torso
player.CharacterAdded:Connect(function()
character = player.Character
humanoid = character:WaitForChild('Humanoid')
if humanoid ~= nil then
if humanoid.RigType == Enum.HumanoidRigType.R6 then
torso = character:WaitForChild('Torso')
elseif humanoid.RigType == Enum.HumanoidRigType.R15 then
torso = character:WaitForChild('UpperTorso')
end
end
end)
Haven’t tested but it should work
I haven’t seen the script that you sent, I am just basing this off of the first script from the initial post