Hi, my problem is this:
I want to do a simple server-side script to simulate an attack with a tool, but when I try to get the player’s mouse, my script doesn’t detect the mouse…
-- SERVER SCRIPT || PARENT OF THE SCRIPT = TOOL
tool.Equipped:Connect(function()
local char = tool.Parent
local plr = players:GetPlayerFromCharacter(char) --Getting the player who owns the tool
if char then -- If the player character exists (works fine...)
local mouse = plr:GetMouse()
print(mouse) -- (Actually this prints nil)
mouse.Button1Down:Connect(function()
-- [REST OF SCRIPT...]
end)
end
end)
I have a doubt if the problem comes because it is a server script
Or if I have to change it to a client script.