I’m addind a special ability in my game where it can create a ball that one shots whoever it touches, and it tweens to the mouse, but whenever I test it, Instead of tweening to the mouse, it tweens to 0,0,0
LocalScript
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local m = plr:GetMouse()
local mouse = m.Hit
uis.InputBegan:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.Q then
script.Parent.AbilityEvent:FireServer(mouse)
end
end)
ServerScript
local cooldown = 15
local useTime = 5
local active = false
local oncd = false
local equipped = false
script.Parent.AbilityEvent.OnServerEvent:Connect(function(plr, mouse)
if equipped == true then
if active == false and oncd == false then
active = true
local char = plr.Character
local hrp = char:WaitForChild("HumanoidRootPart")
local cf = hrp.CFrame
local lv = cf.LookVector
local part = Instance.new("Part")
part.CFrame = cf + (lv * Vector3.new(5,5,5))
part.Anchored = true
part.BrickColor = BrickColor.new("Hot pink")
part.Material = "Neon"
part.Shape = "Ball"
part.Size = Vector3.new(4,4,4)
part.CanCollide = false
part.Parent = workspace
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end)
local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(useTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local goal = {Position = Vector3.new(mouse)}
local tween = ts:Create(part,tweenInfo,goal)
tween:Play()
wait(useTime)
part:Destroy()
active = false
oncd = true
wait(cooldown)
oncd = false
end
end
end)
script.Parent.Equipped:Connect(function()
equipped = true
end)
script.Parent.Unequipped:Connect(function()
equipped = false
end)