Anti-Inappropriate W S Spamming

Recently, I Saw a video in roblox forsaken, of a system they made to prevent inappropriate W S antics, and I was inspired

So. I decided to make a script. That prevents you from “doing the wiggle dance” on another robloxian.

Here is a video showcasing my creation

You can use it simply by adding a LocalScript to game.StarterPlayer.StarterPlayerScripts, and entering this code:

local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local taps = {}
local lastPressTime = 0

RunService.PostSimulation:Connect(function()
	local now = tick()

	while #taps > 0 and now - taps[1].time > 1 do
		table.remove(taps, 1)
	end
end)

local function near()
	for _, player in game.Players:GetPlayers() do
		if player == game.Players.LocalPlayer and player.Character and player.CharacterAppearanceLoaded then continue end
		
		if (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude <= 7 then
			return true
		end
	end
	
	return false
end

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end

	if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.S then
		local now = tick()
		
		if not near() then return end
		table.insert(taps, {key = input.KeyCode, time = now})
		
		if #taps >= 5 then
			local valid = true
			for i = 2, #taps do
				if taps[i].key == taps[i-1].key then
					valid = false
					break
				end
			end

			if valid and (taps[#taps].time - taps[1].time) <= 1.5 then
				game.Players.LocalPlayer:Kick("Really?")
				taps = {}
			end
		end
	end
end)

I hope this code helps you prevent such shenanigans from happening in your game.

34 Likes

This does not account for other kinds of movement made without the use of the W and S keys, namely the arrow keys, but most importantly, players playing on other platforms. A better solution would be to measure objectspace displacement or by distance to see if it changes in a consistent wave-like manner. Furthermore, this should be on the server, not the client.

15 Likes

A better solution would to just not have this system because it is unfortunately very unnecessary. You’re stopping something that really doesn’t affect the environment of your game.

To my knowledge, there has never been a game that implemented a system like this because it is just so unnecessary.

The community doesn’t do anything bad with it, it has always been apart of Roblox unfortunately.

37 Likes

(Unless the video is fake, I never bothered to check)


I agree with you on the basis that its impact is subjective. But the argument is that if people do it for trolling, then trolling them back in the form of punishments is warranted. Another opinion is that it’s a toxic behavior that does indeed ruin the atmosphere of games because player engagements has been degenerated into what’s essentially harassment.

4 Likes

I can smell the false positives from a mile away.

30 Likes

wow cool! i don’t have any of word about this.

3 Likes

Most pointless resource to ever exist.

30 Likes

true, I never thought an act of waking up players is inappropriate

6 Likes

You still have time to delete this.

11 Likes

This is interesting, and I never knew Forsaken had this.

Also, you just can’t have a resource made on the DevForum without instant backlash.

8 Likes

why we sensitive over everything.

3 Likes

Cool resource. I Like. Very Cool and Awesome

criticism ~= backlash. There is a genuine reason this is kind of useless.
You can argue that its too sensitive and you can argue that its needed.

13 Likes

fr, not trying to be rude but the code is not great. (my code isnt that great but this is very prone to false positives.)

5 Likes

Please remember that the vast majority of roblox players are children

4 Likes

This is pretty awesome, but I think you should make this only kick you when you’re within a certain stud radius within another player.
Good work.

Looked at it, and seems its already prevented, I don’t see why they 'res so much arguing.

1 Like

this tbh. this may not be the most useful resource for everyone, but it certainly is a nice one to have.

4 Likes

I agree that this could be very useless in some cases. But as NOVEIGMA, stated it’s an option for the developer to chooose to add it or not.

If the creator behind it truly wants to keep it up and usable. Then they will try their best to fix any false positives or bugs that the detection has.

This is just bloatware… Pretty pointless resource in my opinion, it wastes SO MUCH CPU cycles in your game just for it to false positive.

9 Likes