I just started to learn filtering enabled, and the idea is to create a part in the server when the player presses a key.It works for me in Studio but when I Start a server in studio to see if it actually works with FE on it doesn't work anymore
--This is in a local script. Player = game:GetService("Players").LocalPlayer Char = Player.Character mouse = Player:GetMouse() mouse.KeyDown:connect(function(key) if key == "j" then script.Test.JustTesting:FireServer() end end) --This is a script inside the local script Player = game:GetService("Players").LocalPlayer Char = Player.Character --JustTesting is a remote event inside the script script.JustTesting.OnServerEvent:connect(function() a = Instance.new("Part", workspace) a.CFrame = Char.Torso.CFrame*CFrame.new(0, 0, -10) end)
Thank you!
Using the mouse for path access to the keyboard is deprecated, use UserInputService
instead.
Also, when communicating between remote events, you can't leave the empty parenthesis hanging, you must send a variable, object, or value through it. If you are only attempting to contact the other server script without needing to place a parameter or value, just place in nil
.
Access UserInputService
using the method :GetService()
.
Userinputservice = game:GetService("UserInputService")