I Need Help With Mouse

I am Having Problems using Mouse (I Shouldnt be Using Mouse, but for this posts sake pls ignore the fact that its Superseded by UserInputService). I Have made a RemoteEvent, a LocalScript and a Normal Script. I Want to Get Mouse.UnitRay Property but i cant. I Tried simplifying my script to check if its even firing and its not even FIRING.
also if i try to print/warn anything in local scripts OR even Server Scripts it doesnt. I Tried doing it on 2 seperate devices just to check if its a bug but its not working on both.

Client Script/Local Script

wait(10) -- so that everything loads
local Remote = game.ReplicatedStorage.RemoteEvent

local Mouse = game.Players.LocalPlayer:GetMouse()

Remote:FireServer(Mouse.Hit)

print("THIS DOES PRINT:CLIENT")

Server Side

local Remote = game.ReplicatedStorage.RemoteEvent

Remote.OnServerEvent:Connect(function(plr,Remains)
print(remains)
end)

print("THIS DOES PRINT : SERVER")

Nothing Prints On the Output

You should add an if statement to it so it’s like:

Client Script/Local Script

local Remote = game.ReplicatedStorage.RemoteEvent
local Mouse = game.Players.LocalPlayer:GetMouse()

if Mouse.hit then
    wait(10) -- so that everything loads
    Remote:FireServer()
    print("THIS DOES PRINT:CLIENT")
end

Just include the print in the function and write “player” instead plr because you don’t have a variable called “plr” that refers to the actual player

Server Side

local Remote = game.ReplicatedStorage.RemoteEvent

Remote.OnServerEvent:Connect(function(player,Remains)
    print(Remains)
    print("THIS DOES PRINT : SERVER")
end)

Now it should works properly, i got to go right now if it’s not working I’ll try to look at it when I’m back home. I hope i helped you!

I am Thankful for your help though i have tried that before and tried force it print that on client and through remote on server but no avail. its ok i guess i will have to look for other solutions bye :slight_smile:

The problem with the script above is that it checks if there’s a Mouse.hit and if none, do nothing. And the script stop’s and the remote event never fires. Because the script runs and ends before the player even loaded.
What you should do is attach it to a Mouse.MouseButton1Down event so that whenever the mouse clicks you can get a Mouse.hit

local Remote = game.ReplicatedStorage.RemoteEvent
local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.MouseButton1Down:Connect(function()
   if Mouse.Hit then
     Remote:FireServer(Mouse.Hit)
     print("THIS DOES PRINT:CLIENT")
   end
end)

Hol Up this might actually work

So it Doesnt Work that way aswell.
Also now i have a 2nd issue.
Nothing Prints on the Local Script even if its outside function scope
like if i try to

warn("This Is Printed on to Output")

with no other code on a local script it doesnt print. Even on the Dev Console. i request you to check if its a bug.
i will be sending RBXL File Shortly. Thanks to Everyone on this Thread for your Help

its like this

Mouse.Button1Down:Connect(function()

not

Mouse.MouseButton1Down:Connect(function()

also mouse got superseded by userinputservice you should use that if you want more platform support

ok i am just opening studio lets check

IT CRASHED 0_0… Guess Never Touching that Script Again. It Didnt even let me See XD

??
wdym crashed

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Button1Down:Connect(function()
	print(Mouse.Hit)
end)

no like as soon as i opened the place it just crashed my whole system thats i was un responsive the whole time

i am now starting to think that the script is corrupted

did you crash when opening the place or when testing?

opening. i am opening it again

Ok it loaded now. Now lets check the script

Do Local Scripts Not Print/Warn on output

they do
do you have your output bar even open?

Yes i do and i am not seeing any text except the stuff that come on default when you playtest.All Contexts is also on

are you clicking left button of your mouse?

These are the scripts the remote. It Doesnt work even though it should. i think its my Computer. Could you ty it in studio just for once.
mousetest.rbxm (2.0 KB)
worst thing i that it doesnt even error for once( if its incorrect)