Anyone know why my shooting script that parents the ball in workspace on a remote event is saying
“Workspace.Basketball.ShootScript:4: attempt to index nil with ‘Position’”
|| My code ||
script.Parent.Shoot.OnServerEvent:Connect(function(Player, Goal, Percentage)
if script.Parent.Handler.Value == Player.Name then
local Gravity = Vector3.new(0, -workspace.Gravity, 0)
local Traject = tonumber(.99) + (Player.Character.HumanoidRootPart.Position - Goal.Position).Magnitude / tonumber(100)
local X0 = script.Parent.Position
local V0 = (Goal.Position - X0 - 0.5 * Gravity * Traject * Traject) / Traject
script.Parent.Contest.Value = 0
script.Parent.Parent = workspace
script.Parent.Motor6D.Part0 = nil
script.Parent.CanCollide = true
script.Parent.Velocity = V0 + Vector3.new(Percentage - 1, Percentage - 1)
script.Parent:SetNetworkOwner(nil)
script.Parent.RotVelocity = Vector3.new(0, 0, 15)
end
end)