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

Tell me about FilteringEnabled?

Asked by 6 years ago

Can anyone tell me the answer to these questions? 1.) Can you use a local script to damage an enemy in Filtering Enabled without using remotes? 2.) Can you use a local script to animate our character in FE without using remotes? 3.) How to test if a script works or not in FE place? do you need 2 computers/accounts?

0
As I see question 2 wasn't answered correctly, animations do require localscripts (unless NPCs) User#20388 0 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Well, you can damage an enemy, but it will be local only, i.e. only the player damaging the enemy can see their health go down. Even if the enemy dies on the player's screen, it will not affect the server in any way (Considering that the 'enemy' is another player). For example:


--LocalScript local UserInputService = game:GetService('UserInputService') local function OnInput(Input, gameProcessed) if Input.KeyCode == Enum.KeyCode.Insert then for _, v in ipairs(game.Players:GetChildren()) do if v.Character:FindFirstChildOfClass('Humanoid') then v.Character.Humanoid:TakeDamage(25) end end end end UserInputService.InputBegan:Connect(OnInput)

Now, the code above will kill players local to the player who used it, but on the screen of the player and on the server, nothing will change. That's why they're called LocalScripts. But, if you design your code like mine, you can kill others and it will appear on their screen that they are being damaged as well:


--LocalScript local UserInputService = game:GetService('UserInputService') local ReplicatedStorage = game:GetService('ReplicatedStorage') local InputService = ReplicatedStorage:WaitForChild('InputService') --InputService is a RemoteEvent local function OnInput(Input, gameProcessed) if Input.KeyCode == Enum.KeyCode.Insert then InputService:FireServer() end end UserInputService.InputBegan:Connect(OnInput) --ServerScript local ReplicatedStorage = game:GetService('ReplicatedStorage') local Playes = game:GetService('Players') local InputService = Instance.new('RemoteEvent', ReplicatedStorage) InputService.Name = 'InputService' local function OnInputEvent() for _, v in ipairs(game.Players:GetChildren()) do if v.Character:FindFirstChildOfClass('Humanoid') then v.Character.Humanoid:TakeDamage(25) end end end InputService.OnServerEvent:Connect(OnInputEvent)

Now, THIS is the ideal code if you want other players to notice that they are being damaged. RemoteEvents and RemoteFunctions are the most important part of making a game which is compatible with FilteringEnabled. So, always use them if you want the client to communicate with the server.

Now, as I previously said, you can animate your character using LocalScripts, but they actually replicate, so no problems. The real problem starts when you use Lerp() to animate a player (using welds). If so, then good luck to you. It NEVER works. You NEED to animate the player on the server (if using Lerp()), or else, the arms will just break off if you do it on a LocalScript.

Also, you don't need two accounts or computers to test your game. You can publish it to Roblox and then ask a friend to help you test your game, or just go and start your own Local Server in Studio by going to Test > Start. You can set the amount of clients you want to have in the server. All the clients are controlled by you on different windows.

Anyways, hope this answer helped. Just ask me if you ever want some help, I'd be glad to. Have a great day ahead!

0
I see.. thank you so much :) FlonexVorry 28 — 6y
0
Ready to help any time, midude ;D. Liquid_Napalm 20 — 6y
Ad
Log in to vote
1
Answered by
IcyEvil 260 Moderation Voter
6 years ago

For questions 1 and 2

For you to have functional scripts in any game with FilteringEnabled you HAVE to use remotes.

For your 3rd question. No, you do not need two accounts, you can simply test it via either studio, or publishing it and going in-game to see results.

0
Animations are weird. You can execute via a local script, and it will replicate. oftenz 367 — 6y
0
Thank you :) FlonexVorry 28 — 6y

Answer this question