I’m trying to make a sword skill but there is a problem is this script. It is a local script so :GetMouse() should work but it is not. It says that GetMouse is not a valid member of Players “Players”. Also, is there a way that I can have the skill only work if the sword is equipped right now you can activate the skill without the sword?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Error:
Code:
local player = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local cooldown = false
Mouse = player:GetMouse()
UIS.InputBegan:Connect(function(Input,Chat)
if Chat then return end
if Input.KeyCode == Enum.KeyCode.Z then
cooldown = true
print("skill Thrown")
local mousepos = Mouse.Hit
RS.SlashEvent:FireServer(mousepos,Mouse.Hit.p)
local animation = player.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(script.SwordSlashAnim)
animation:Play()
game.Debris:AddIten(animation,2)
task.wait(5)
cooldown = false
end
end)
Please help, I need to use this system for 100+ more attacks. I know this is not the best system but I’m bad at coding.