I am trying to make a script for a script builder game.
(If you don't know what that is, you just upload a script to the game and it runs it and you can fight people etc with your scripts.)
I am just confused about how people get the players mouse in the game from a server script? I've seen people do it with guns and such.
Anyone know how to or any ideas?
You can't Server scripts are made for server side stuff only. A way you can use to obtain the player's mouse position for example is using Remote Events!
EXAMPLE: Local script:
mouse = game:GetService("Players").LocalPlayer:GetMouse() remote = workspace.Remote -- remote location wait(10) -- wait 10 secs :) remote:FireServer(mouse.Hit.p)
Server script:
workspace.Remote.OnServerEvent:Connect(function(player,HitPos) print(HitPos) -- print mouse position in 3d space print(player.Name) -- print player who fired it :D end)
Remember that the local script should be in Clientside environment such as PlayerGui or PlayerScripts for example
Good luck!
This is correct you cannot get a mouse using a server script just like when you can't get the current camera in a server script they're only things that can be access in a local script.