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

Script gives me an error and says parent even tho theres no parent in any line?

Asked by 5 years ago

trying to make a hitch script, but it gives me an error saying: 21:30:16.068 - Players.ieatandisbaconhair.PlayerGui.ScreenGui.LocalScript:8: attempt to index field 'Parent' (a nil value)

script:



local plr = game.Players.LocalPlayer game:GetService("UserInputService").InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.H then for i,v in pairs(game.Workspace.Vehicles:GetChildren()) do if v.CarOwner then local mag = (v.HingePart.Position-v.Trailer.HingePart.Position).Magnitude if mag <= 1 then local mag2 = (v.HingePart.Position-plr.Character.HumanoidRootPart.Position).Magnitude if mag2 <= 10 then if v.CarOwner.Value == game.Players.LocalPlayer.Name then if v.IsHitched.Value == false then v.HitchTrailer:FireServer() v.IsHitched.Value = true elseif v.IsHitched.Value == true then v.UnHitchTrailer:FireServer() v.IsHitched.Value = false end end end end end end end end)
0
can you tell me what line this error is on? Joshument 110 — 5y
0
line 8 Fad99 286 — 5y

Answer this question