When I load into my game, I'm greeted with this lovely error that spams the console: http://prnt.sc/evower
This is the code that it references:
local Rotation = Vector3.new(Mouse.Hit.X, Torso.CFrame.Y, Mouse.Hit.Z)
What is causing the error and how can I go about fixing it? I'm not one to normally ask for help, but this really has me stumped.
Full Function:
local Player = game.Players.LocalPlayer
local Char = Player.Character
local Torso = Char:WaitForChild("Torso",0.1)
local events = {}
local bv = Instance.new("BodyGyro",Torso)
bv.maxTorque=Vector3.new(math.huge,math.huge,math.huge)
bv.P = 15000
local bag_tag = nil
local npc_tag = nil
events[#events + 1] = Mouse.Move:connect(function()
local Rotation = Vector3.new(Mouse.Hit.X, Torso.CFrame.Y, Mouse.Hit.Z)
bv.cframe=CFrame.new(Torso.CFrame.p, Rotation)
if(Mouse.Target ~= nil) then
local tar = Mouse.Target
if(tar.Parent == game.Workspace.Parts.Item_Bags) then
if(tar:FindFirstChild("Item") and tar:FindFirstChild("User")) then
make_bag_tag(tar)
elseif(bag_tag) then
bag_tag:Destroy()
bag_tag = nil
end
elseif(bag_tag) then
bag_tag:Destroy()
bag_tag = nil
end
if(tar.Parent.Parent == game.Workspace.Mobs.NPC) then
if(tar.Parent:FindFirstChild("Head")) then
make_npc_tag(tar.Parent)
elseif(npc_tag) then
npc_tag:Destroy()
npc_tag = nil
end
elseif(npc_tag) then
npc_tag:Destroy()
npc_tag = nil
end
else
if(bag_tag) then
bag_tag:Destroy()
bag_tag = nil
end
if(npc_tag) then
npc_tag:Destroy()
npc_tag = nil
end
end
end)

4 comments
Try just having ":WaitForChild("Torso")" instead, as it may have timed out before it could get the torso.
When I remove the time value, it doesn't function at all and then just says infinite yield possible
Are you using R15? If so, you should use "UpperTorso" instead of "Torso".
That was the issue, thanks.