Is this a good approach to vaulting? (i already know it isn't)

i have been awake since 3 am because i’m sick ash, but that doesn’t stop my sigma coding grind :muscle: :sunglasses:

right;

i wanna do vaulting, i want to make it safe but also want to avoid handling it on the server (because i think that would be bad!)


step by step of what i want to do:

  • player jumps
  • invisible detector part gets created
  • if nothing is colliding with it, allow the player to press space to vault
  • move the player to the position of the detector part using tween service

here’s a showcase:


now the very obvious issues is that this code very exploitable, i am very aware of it

but i want to avoid doing this on the server, because i feel like repetitively updating some stupid part’s cframe every frame (While it exists) would be extremely bad to do,

additionally it would be tough to communicate between client and server, especially when i want to tell the client they can vault


this is my current code

local tService = game:GetService("TweenService")
local uInputService = game:GetService("UserInputService")

-- Tween parameters;
local vaultTweenParams = TweenInfo.new(
	1,
	Enum.EasingStyle.Back,
	Enum.EasingDirection.Out
)

-- Player variables;
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid: Humanoid = char:WaitForChild("Humanoid")
local head: BasePart = char:WaitForChild("Head")

-- Functions;
local function CreateDetectorPart()
	local detectorPart = Instance.new("Part")
	
	detectorPart.Size = Vector3.new(4, 0.5, 2)
	detectorPart.Position = head.CFrame.Position + Vector3.new(0, 0.5, 2) -- Right at the top of the head
	-- and slightly infront of the player
	
	detectorPart.CanCollide = false
	detectorPart.Parent = workspace
	detectorPart.Name = "VaultDetector"
	
	return detectorPart
end

local function MoveDetectorPart(detectorPart: BasePart)
	local inputConnection = nil
	
	while detectorPart do
		local newPosition = head.CFrame.Position + Vector3.new(0, 0.5, 2)
		
		detectorPart.CFrame = CFrame.new(newPosition)
		
		local detectionBounds = workspace:GetPartsInPart(detectorPart)
		
		if #detectionBounds > 0 then
			detectorPart.Color = Color3.fromRGB(255)
			continue
		end
		
		detectorPart.Color = Color3.fromRGB(0,255,0)
		
		inputConnection = uInputService.InputBegan:Connect(function(input)
			local key = input.KeyCode
			
			if key ~= Enum.KeyCode.Space then return end
			
			-- TODO: FINISH ME!
			
			inputConnection:Disconnect()
		end)
		
		task.wait()
	end
	
	if inputConnection then inputConnection:Disconnect() end
end

local function OnStateChanged(old: Enum, new: Enum)
	if new ~= Enum.HumanoidStateType.Freefall or new ~= Enum.HumanoidStateType.Jumping then
		local detectorPart = workspace:FindFirstChild("VaultDetector")
		
		if detectorPart then detectorPart:Destroy() end
		return
	end
	
	local detectorPart = CreateDetectorPart()
-- This function isn't very much finished yet, don't worry about that!!
end
1 Like

I cant understand the reason for why u used the movedetectorpart function, but since you did mention that you dont want to do the vault sanity checking on the server, don’t worry! Servers are designed for small checks. The code is highly exploitable and the hacker can just tp on top of the part, or just change their state at will. From my thoughts, using remote events for checking is not as bad as you think. Roblox servers are way more powerful and flexible and can do alot of calculations mostly due to the fact that they dont really have to render stuff. Anyways you can search this up on youtube, there are countless tutorials on this already:

Also don’t expect us to end exploiting, its basically impossible to stop them!

1 Like

all my efforts, for nothing…

well i suppose raycasting is a much better thing to do rather than doing whatever the hell i wanted to do :sob:

cheers vro

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.