You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Stop players from kicking the ball outside of the boundaries
- What is the issue? Include screenshots / videos if possible!
since the ball attatches to the player (like Kick Off,) the player who has the ball can walk up to a wall (the ball is non collideable) and if they kick the ball, the ball will go outside of the boundary because the ball is outside of the wall when it is attatched
like this
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried to CFrame the ball to the HumanoidRootPart before it is launched but this makes the ball warp behind the player which messes up the accuracy of the shot.
Shoot.OnServerEvent:Connect(function(player)
local part = script.Parent
part.CanCollide = true
if part:FindFirstChild("ManualWeld") then
part:FindFirstChild("ManualWeld"):Destroy()
end
local Character = player.Character
local bf = Instance.new("BodyForce",script.Parent)
if part:FindFirstChild("ManualWeld") then
part:FindFirstChild("ManualWeld"):Destroy()
end
local Firing = Character.Humanoid:LoadAnimation(script.Anim)
Firing:Play()
bf.Force= Character.HumanoidRootPart.CFrame.lookVector*3000 + Vector3.new(0,4000,0)
game.Debris:AddItem(bf,0.3)
local S = Instance.new("Sound",part)
S.SoundId = "rbxassetid://4458219865"
S.PlaybackSpeed = 1
S.Volume = 0.5
S:Play()
Character.HumanoidRootPart.Anchored = true
script.BallShotCooldown.Value = true
script.BallTaken.Value = false
script.BallHolder.Value = ""
wait(1)
Character.HumanoidRootPart.Anchored = false
Firing:Stop()
part.Trail.Color = ColorSequence.new({ -- a color sequence shifting from white to blue
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(239, 184, 56))
}
)
script.BallShotCooldown.Value = false
end)