hi, i made a script for slide in my tackle tool for my soccer game.
there is only one error that gives me and its:
" Position is not a valid member of IntValue “Workspace.Ball”"
here the local script
local TM = require(script.Parent.Parent:WaitForChild("ToolManagment"))
local Tween = require(script.Parent.Parent:WaitForChild("Module_Management"):WaitForChild("Tweening"))
local GetUp2 = require(script.Parent.Parent:WaitForChild("GetUp"))
local RightAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.R)
local LeftAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.L)
Kick = false
Equipped = false
Tool = script.Parent
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
Speed = 38
Range = 300
script.Parent.Equipped:connect(function(m)
Equipped = true
end)
script.Parent.Unequipped:connect(function(m)
Equipped = false
end)
Mouse.Button1Down:connect(function()
if not workspace.Configuration.SlideTackle.Value then return end
if not CloseEnoughToABall() then return end
if Equipped == false then return end
if TM.GetUsing() then return end
workspace.Camera.CameraSubject = Player.Character.Humanoid
TM.SetUsing(true)
Player.Character.Torso.RotVelocity = Vector3.new()
Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
local SF = Instance.new("BodyVelocity")
SF.Parent = Player.Character["Torso"].Parent.HumanoidRootPart
SF.MaxForce = Vector3.new(math.huge,0,math.huge)
SF.Velocity = Player.Character["Torso"].Parent.HumanoidRootPart.CFrame.lookVector * 25
game.Debris:AddItem(SF, 1.3)
local Direction = Enum.EasingDirection.Out
local Style = Enum.EasingStyle.Back
local Duration = 0.4
Player.Character.Humanoid.WalkSpeed = 0
Player.Character.Humanoid.JumpPower = 0
Player.Character.Humanoid.AutoRotate = true
Player.Character.HumanoidRootPart.CollisionGroupId = 0
Player.Character["Right Leg"].CollisionGroupId = 0
Player.Character["Left Leg"].CollisionGroupId = 0
Player.Character["Right Arm"].CollisionGroupId = 0
Player.Character["Left Arm"].CollisionGroupId = 0
Player.Character["Torso"].CollisionGroupId = 0
Player.Character["Head"].CollisionGroupId = 0
if TM.check() == "R" then
RightAnim:Play()
else
LeftAnim:Play()
end
Kick = true
wait(1.3)
TM.ResetWelds()
Player.Character.Humanoid.AutoRotate = false
Kick = false
SF.Velocity = Player.Character["Torso"].Parent.HumanoidRootPart.CFrame.lookVector * 0
wait(0.6)
Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
Player.Character.Humanoid.PlatformStand = false
Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
Player.Character.HumanoidRootPart.CollisionGroupId = 0
Player.Character["Right Leg"].CollisionGroupId = 0
Player.Character["Left Leg"].CollisionGroupId = 0
Player.Character["Right Arm"].CollisionGroupId = 0
Player.Character["Left Arm"].CollisionGroupId = 0
Player.Character["Torso"].CollisionGroupId = 0
Player.Character["Head"].CollisionGroupId = 0
Player.Character.Humanoid.WalkSpeed = 20
Player.Character.Humanoid.JumpPower = 50
Player.Character.Humanoid.AutoRotate = true
wait(1.2)
TM.SetUsing(false)
end)
Player.Character["Right Leg"].Touched:connect(function(hit)
if Kick == false then return end
if hit.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Trip_Player:FireServer(hit.Parent)
Kick = false
end
if hit.Name ~= "Ball" then return end
local force = Player.Character["Right Leg"].CFrame.lookVector * 70
local angle = Vector3.new(9000,1000,9000)
Kick = false
TM.ApplyForce(hit, angle, force, "Right Leg")
end)
Player.Character["Left Leg"].Touched:connect(function(hit)
if Kick == false then return end
if hit.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Trip_Player:FireServer(hit.Parent)
Kick = false
end
if hit.Name ~= "Ball" then return end
local force = Player.Character["Left Leg"].CFrame.lookVector * 70
local angle = Vector3.new(9000,1000,9000)
Kick = false
TM.ApplyForce(hit, angle, force, "Left Leg")
end)
function CloseEnoughToABall()
local Character = Player.Character
if not Character then return end
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
if not HumanoidRootPart then return end
local CharacterPosition = HumanoidRootPart.Position
local ClosestBall
local ClosestBallDFC
local Children = workspace:GetChildren()
for _, Child in pairs(Children) do
if Child.Name == "Ball" then
local DescendantPosition = Child.Position
if ClosestBall and ClosestBallDFC then
local DistanceFromCharacter = (CharacterPosition - DescendantPosition).Magnitude
if DistanceFromCharacter < ClosestBallDFC then
ClosestBall = Child
ClosestBallDFC = DistanceFromCharacter
end
else
local DistanceFromCharacter = (CharacterPosition - DescendantPosition).Magnitude
ClosestBall = Child
ClosestBallDFC = DistanceFromCharacter
end
end
end
if ClosestBallDFC then
if ClosestBallDFC < Range then
return true
else
return false
end
else
return false
end
end
function ChangeOwner(ball)
game.ReplicatedStorage.ChangeOwner:FireServer(ball)
end
the line that gives me the error its in Child.Position
how do i solve the error?