local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() wait(1) local Humanoid = Character.Humanoid or Character:WaitForChild("Humanoid") local mouse = Player:GetMouse() local ok = 0
function charge() if ok == 0 then ok = 40 local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://4364880762" local animationtrack = Humanoid:LoadAnimation(anim) animationtrack:Play() wait(0.2) local ball = Instance.new("Part") ball.Shape = "Ball" ball.CFrame = Humanoid.RightArm.CFrame * CFrame.new(0,-0.9,0) ball.Size = Vector3.new(1, 1, 1) ball.Parent = game.Workspace ball.Material = "Neon" ball.BrickColor = BrickColor.new("Blue") ball.Transparency = 0 ok = 3 end end
mouse.KeyDown:Connect(function(key) if key == "q" then charge() end end)
Don't use
mouse.KeyDown:Connect(function(key) if key == "q" then charge() end end)
You can use it, but UIS, or User input service is alot more efficient.
Here's an example of how UIS looks like:
local UIS = game:GetService('UserInputService') UIS.InputBegan:connect(function(key,istyping) if key.KeyCode == Enum.KeyCode.Q then -- do whatever here end end)
Also, next time when posting your issue, please, put your line of code in a code block!