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()
Amblefell
(当来自阿莫古斯的冒名顶替者是巴个非常可疑)
November 15, 2022, 9:36pm
#2
what error are you getting in your output
Orbular3
(Orbular3)
November 15, 2022, 9:38pm
#3
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)
realmile
(mile)
November 15, 2022, 9:39pm
#4
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.
system
(system)
Closed
November 29, 2022, 9:45pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.