ProximityPrompt Server Vs UIS/ContentActionService Question

A while back, I thought of putting a ProximityPrompt inside the character and not using UserInputService or ContextActionService which is client, ProximityPrompt only use the server.

Example
Let say I have a Shift to Run LocalScript(client).

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

local LocalPlayer = Players.LocalPlayer or Players.PlayerAdded:Wait()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")

UserInputService.InputBegan:Connect(function(gamepross,Object)
  if Object.KeyCode == Enum.KeyCode.LeftShift then
         Humanoid.WalkSpeed = 60
      end
end)

UserInputService.InputEnded:Connect(function(gamepross,Object)
  if Object.KeyCode == Enum.KeyCode.LeftShift then
         Humanoid.WalkSpeed = 30
      end
  end)

This is most easy for exploiters to use, they can just edit the walkspeed, I could check if walkspeed was changed but, they can always delete anything that on client, let say I made a server script where I would use Humanoid.Running Event, I can check if there running passed the walkspeed and i could kick them, but whenever player press shift it would detect, and then player would kick. I could send a remoteevent by cilent to server, but exploiter are able to use fire remoteevents.

Soo this when I realize that ProximityPrompt works with Server and not on the client. which is where I’m able to make a pro gamer move. i could copy a ProximityPrompt and place it on the Torso, and then i could use PromptButtonHoldBegan or PromptButtonHoldEnded to detect when player press key, changed the walkspeed, and be able to check running event without having to use any remoteevents.

But my main question is, Would this be a good idea, and Would this lag Server due to players pressing KeyCodes.

In theory, this is a good idea. But as you said, yes, it’d lag the server if someone were to spam shift every couple miliseconds, especially if the server is big.

You actually thought in the right direction! You don’t necessarily have to kick them if the walk speed changes, but rather if the walk speed is changed to a value you know it won’t be to
For example:

Walk speed is 16, running speed is 22
→ Player changes WalkSpeed to 16, is valid
→ Player changes WalkSpeed to 22, is valid
→ Player changes WalkSpeed to 100, isn’t valid, kick player

Here’s an example on how you’d implement it:

local Players = game:GetService("Players")

local allowedSpeeds: { [number] : number} = {16, 22}

Players.PlayerAdded:Connect(function(player: Player)
    player.CharacterAdded:Connect(function(character: Model)
        local humanoid: Humanoid = character:WaitForChild("Humanoid")
        
        if (humanoid) then
            humanoid.Running:Connect(function(speed: number)
                if (not table.find(allowedSpeeds, speed)) then
                    player:Kick("Speed not valid")
                end
            end)
        end
    end)
end)

Remote events with those checks can also work, but I believe it’d make it easier for the exploiter to just set the walk speed to the highest walk speed they discover for the rest of their gameplay.

1 Like