local player = game.Players.LocalPlayer
remote = script:WaitForChild("RokushikiRemote")
UIS = game:GetService("UserInputService")
debounce = false
local fireball = game:GetService("ReplicatedStorage"):FindFirstChild("fireball")
local TweenService = game:GetService("TweenService")
UIS.InputBegan:Connect(function(Input, isTyping)
if not isTyping then
elseif Input.KeyCode == Enum.KeyCode.R and not debounce then
debounce = true
local character = player.Character
local fireball = game:GetService("ReplicatedStorage"):FindFirstChild("Fireball"):Clone()
fireball.Parent = game.Workspace
fireball.Size = Vector3.new(2, 2, 2)
fireball.CFrame = character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, 10, 0)
fireball.Massless = true
local Info = TweenInfo.new(3, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
local properties = {
Color = Color3.fromRGB(255, 0, 0),
Size = Vector3.new(15, 15, 15),
Anchored = true
}
local Tween = TweenService:Create(fireball, Info, properties)
Tween:Play()
Tween.Completed:Wait()
wait()
debounce = false
end
end
end)
UIS.InputEnded:Connect(function(Input, isTyping)
if not isTyping then
if Input.KeyCode == Enum.KeyCode.R and not debounce then
fireball.Anchored = false
local bv = Instance.new("BodyVelocity", fireball)
bv.Velocity = CFrame.new(fireball.CFrame.Position,player:GetMouse().Hit.p).lookVector * 50
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
end
end
end)
What I meant to do here is that to end the tweenservice, when I unpress R. But it wont work and it wont even give body velocity to the fireball, I tried putting Tween:Destroy() it only puts grammar error on Tween. How can I cancel the tween in inputbegan? so that I when I unpress it, it will give bv to fireball and move