Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

HumanoidRootPart is not a valid of Model. How fix?

Asked by 4 years ago
Edited 4 years ago

When i execute script all works fine, but over time stops working. Script:

local plr = game:service("Players").LocalPlayer
local userinputservice = game:service("UserInputService")
local chest = workspace.Chests.LargeChest
_G.distance = 4
userinputservice.InputBegan:connect(function(inp)
   if inp.KeyCode == Enum.KeyCode.T then
       while wait() do
           for _,v in next, chest:GetChildren() do
               v.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.CFrame.X,plr.Character.HumanoidRootPart.CFrame.Y,plr.Character.HumanoidRootPart.CFrame.Z - _G.distance)
               v.HumanoidRootPart.Anchored = true
           end
       end
   end
end)

The problem is that through time writes: HumanoidRootPart is not a valid of Model. Help pls!

PS: Click view source to see all script, becouse website dont show to end!

0
Why are you looping through the chest in order to set the HumanoidRootPart's CFrame? y3_th 176 — 4y
0
But how can do else? Kalinka008 2 — 4y
0
How about not looping through the chest? y3_th 176 — 4y
0
Hm... I will try Kalinka008 2 — 4y
View all comments (2 more)
0
Dont work( Kalinka008 2 — 4y
0
Maybe its works, but maybe i do something not this way... Kalinka008 2 — 4y

Answer this question