Basically I have a local script that fires a remote event and the server script gets the player's mouse target. I try to then use the mouse target to fire the specific client. Even when I verify that the player exists in game.Players the script says it is Unable to cast a value to Object.
I've simplified the code to only show the FireClient() part of the script.
script.Parent:WaitForChild("ArrestPlayer").OnServerEvent:Connect(function(player, mouse_target)
if game:GetService("Players"):FindFirstChild(mouse_target) then
print("yes")
game:GetService("ReplicatedStorage").GameEvents.Tools.ArrestCoreUI:FireClient(mouse_target)
else
print("no")
end
end)
and in the local script I use .Name so I have no idea why it wouldn't work?
local mouse_target = mouse.Target.Parent.Name
script.Parent:WaitForChild("ArrestPlayer"):FireServer(mouse_target)
Any help would be appreceiated

4 comments
^ This answer should be accepted
"mouse_target" is the name of the client I want to fire, it wasn't working so on line 2 I checked if it did exist and if it did then it would fire the client. Can you help me?
Nevermind, solved it.
my bad but you should have indexed it