To make it work, requires two Scripts, one is a normal Script and the other is a LocalScript.
LocalScript:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.KeyUp:Connect(function(Tecla)
if Tecla == "e" then
workspace.RemoteEvents.Arremessar:FireServer()
end
end)
Script:
function Animation(v)
Anim:Play()
BolaHandle.Quicando.Disabled = true
BolaTool.GripPos = Vector3.new(0, 0, 0.7)
wait(1.5)
BolaTool.Parent = workspace
wait()
BolaHandle.Quicando.Disabled = false
local SP = Character.PrimaryPart.Position
SP = SP + (v * 5)
BolaHandle.Position = SP
local Velocidade = Instance.new("BodyVelocity")
Velocidade.MaxForce = Vector3.new(10000, 10000, 10000)
Velocidade.P = 10000
Velocidade.Velocity = (v * Forca.Value) + Vector3.new(0, 50, 0)
Velocidade.Parent = BolaHandle
wait(0.1)
Velocidade:Destroy()
end
function Arremessar(Player)
-- Variáveis
repeat wait() until Player.Character
repeat wait() until Player.Character.Humanoid
BolaTool = Player.Character:FindFirstChild("RBB Ball")
BolaHandle = BolaTool:WaitForChild("Handle")
Forca = BolaTool.Arremessando.Forca
Character = Player.Character
local Humanoid = Player.Character:FindFirstChild("Humanoid")
Anim = Humanoid:LoadAnimation(BolaTool.Arremessando.Arremessando)
-- Código
if Humanoid == nil then
error("Humanoid não encontrado")
return
end
local TP = Humanoid.TargetPoint
local LA = (TP - Character.Head.Position).unit
Animation(LA)
end
script.Parent.OnServerEvent:Connect(Arremessar)
The "v" in the function "Animation" doesn't work in the calcules ('SP = SP + (v * 5)' per example). The Script's objective is:
The Ball tries to go in the direction of the Mouse, but it will fall during the way.
