I cant figure out why my script is not working?
Asked by
4 years ago Edited 4 years ago
Sorry, Im really new at scripting it's giving me an error over hunting. I have looked for a while and I'm not sure what's wrong with it. any help would be awesome. Thanks!
01 | local mypart = Instance.new( "Part" ,workspace) |
02 | local myPos = Vector 3. new( 0 , 10 , 0 ) |
03 | local myLook = Vector 3. new( 0 , 1 , 0 ) |
04 | local myCFrame = CFrame.new(myPos,myLook) |
08 | mypart.CFrame = myCFrame |
09 | Pigred 72 = workspace:WaitForChild( "Pigred72" ) |
10 | myLook = Pigred 72. HumanoidRootPart.Position |
11 | myCFrame = CFrame.new(myPos,myLook) |
15 | local function getClosestAvatarPostion(part) |
16 | local Players = game.Players:GetChildren() |
17 | local PlayerPostion = { } |
18 | if #PlayerPostion then |
20 | for key, Player in pairs (Players) do |
21 | local plName = Player.Name |
22 | local plPos = game.Workspace:WaitForChild(Player.Name).HumanoidRootPart.Positon |
23 | local plDis = (part.Position - plPos).magnitude |
24 | table.insert(PlayerPostion,key { plName,plPos,plDis } ) |
27 | Hunting = PlayerPostion [ 1 ] |
29 | for x = 1 ,#PlayerPostion, 1 do |
30 | if PlayerPostion [ x ] [ 3 ] < Hunting [ 3 ] then |
31 | Hunting = PlayerPostion [ x ] |