Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to learn Filtering Enabled, need some help with this?

Asked by 6 years ago

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!

0
KeyDown is deprecated. Use UserInputService. Also, :connect() is deprecated. Use :Connect(). Also, you are trying to access LocalPlayer from a server script. Also, you never fired the remote event. hiimgoodpack 2009 — 6y
0
'script.Test.JustTesting:FireServer()' doesn't this fire it? brokenrares 48 — 6y
0
Nvm it worked thank you a lot! <3 brokenrares 48 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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")

For the API link click here.

For examples and a short tutorial click here.

0
Thank you a lot for the explanation! brokenrares 48 — 6y
0
You're most welcome! User#18043 95 — 6y
Ad

Answer this question