Hello
I have tried moving a part to my HumanoidRootPart with a for loop using this code:
function onClick(noot) local val = script.Parent.Parent.TextBox.Value.Value local text = script.Parent.Parent.TextBox val = text.Text local plr = game.Players:FindFirstChild(val) local val2 = script.Parent.Parent.dis.Value.Value local text2 = script.Parent.Parent.dis val2 = text2.Text local item = game.ServerStorage.SponsorItems:FindFirstChild(val2) if plr and plr.Character and plr.Character:FindFirstChild("Arm1") and item then if val2 == "Food" then local foood = item.Food:getChildren() -- local clone = foood[math.random(1,#foood)]:Clone() local e = plr.Character.HumanoidRootPart.Position local ab = Vector3.new(e.x, e.y, e.z) for i = 1, ab, .5 do game.Workspace.Sponsor.Position = game.Workspace.Sponsor.Position + i end end end end script.Parent.MouseButton1Click:connect(onClick)
However, it doesn't seem to work, and I don't see the error in the console. Hierarchy: http://prntscr.com/is98wi
While we're at it, do you guys/girls also know how I can clone food in the plr's backpack when the "Sponsor" part touches the HumanoidRootPart?
Thanks
you cannot do this because in order to do the loop, you need one value. An easier way is inserting a Body Position into the root part and inserting the coordinates there.That's just my advice, i hope i helped :)