I need to call a function that can only be had in a server script, how can I call it from a local script? I need to use local script to detect the mouse click in a gui
As yHasteeD stated, to do that, you would need to use remote events. Insert a remote event into replicated storage in the game, reference it as a variable in both scripts, and in the local script do:
remoteEvent:FireServer(mouse.Hit) -- Put whatever you need from the local script in the server script inside the parenthesis, but as I've learned, putting keys in there causes lag, so instead of handling key stuff with the server script, make 3 different remote events and fire them all as each different key if you have multiple keys you need.
Server:
remoteEvent.OnServerEvent:Connect(function(player,mouse.Hit) -- Remember that player is always the first parameter in a server script for remote events, and then the other ones come after.
If you wanted to do the opposite, and fire the local side from the server side, you would basically just do the same thing, but replace FireServer() with FireClient, and OnServerEvent with OnClientEvent, and when firing a client, make sure to include the player as the first parameter, so it can know what local script to fire.
If it still doesn't make sense, then here's what I looked at to figure it all out: https://www.youtube.com/watch?v=4Dc_bri9mjs
Hope that helps!