01 | local m = game.Players.LocalPlayer:GetMouse() |
02 | db = true |
03 | m.KeyDown:connect( function (k) |
04 | k = k:lower() |
05 | if k = = "f" then |
06 | if script.parent.FlapSetting.Value < = 2 then |
07 | script.parent.FlapSetting.Value = script.parent.FlapSetting.Value + 1 |
08 | end |
09 | end |
10 | end ) |
This works flawlessly without FE enabled but has no function whatsoever when I enabled it. It is in a local script
Do something like when the player presses a key on a LocalScript, it fires a remote event that the server sided script picks up. The server will do all the changing values and stuff.
Here's an example.
Note: I used UserInputService as Roblox says the mouse keydown function is deprecated. Basically, they recommend using this one.
LocalScript
1 | game:GetService( "UserInputService" ).InputBegan:connect( function (key) |
2 | if key.KeyCode = = Enum.KeyCode.F then |
3 | script.Parent.RemoteEvent:FireServer() -- RemoteFunction can be anywhere, as long as the server script knows where it is. |
4 | end |
5 | end ) |
Script
1 | script.Parent.RemoteEvent.OnServerEvent:connect( function (plr) |
2 | --The first argument in an OnServerEvent is the player who fired the RemoteEvent. |
3 |
4 | --Code here, this will be in a server script so everyone see's the change. |
5 | end ) |