Answered by
8 years ago Edited 8 years ago
Well, UIS won't work on the server, so try using RemoteEvents
or RemoteFunctions
.
They are pretty similar, the main difference being RFunctions
can return values and are accessed as functions instead of events. Example of both:
LocalScript
1 | local reloadEvent = game.ReplicatedStorage.ReloadEvent |
3 | function onKeyPress(input) |
4 | if input.KeyCode = = Enum.KeyCode.R then |
5 | reloadEvent:FireServer() |
9 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |
ServerScript
01 | local reloadEvent = game.ReplicatedStorage.ReloadEvent |
03 | reloadEvent.OnServerEvent:connect( function (clientFiredFrom) |
09 | function reloadFunction.OnServerInvoke:connect(clientFiredFrom) |
Hope I helped!
~TDP