I am making a script for throwing a ball, for some reason, the script doesn’t work because of
GetMouse() not working, here’s my code:
local tool = script.Parent
local char = tool.Parent
local plr = game:GetService("Players"):GetPlayerFromCharacter(char)
local mouse = plr:GetMouse()
November 15, 2022, 9:36pm
what error are you getting in your output
November 15, 2022, 9:38pm
The character might not be the parent right at the start of the script because the char needs to load in and get the tool first - try print(char)
November 15, 2022, 9:39pm
Parent of the tool is either
Backpack or players character when equipped, so if its not equipped your code wont work.
GetMouse() only works in local scripts so you can get the player by simply doing
player = game.Players.LocalPlayer.
Is this a serverscript? If yes, keep in mind that you can only get the player’s mouse from a localscript.
November 29, 2022, 9:45pm
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.