콘텐츠로 건너뛰기
작동 중

Snap Tap Movement

CLclarkdevlinorg0 조회수Universal2026년 7월 26일
공유
Snap Tap Movement

스크립트 코드

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

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

-- Wait for character and humanoid
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

player.CharacterAdded:Connect(function(newCharacter)
	character = newCharacter
	humanoid = newCharacter:WaitForChild("Humanoid")
end)

-- Disable default controls
local PlayerModule = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"))
local controls = PlayerModule:GetControls()
controls:Disable()

-- Input tracking
local keys = {
	[Enum.KeyCode.W] = false,
	[Enum.KeyCode.S] = false,
	[Enum.KeyCode.A] = false,
	[Enum.KeyCode.D] = false,
	[Enum.KeyCode.Space] = false
}

-- Last pressed stacks for opposing directions
local verticalStack = {} -- W, S
local horizontalStack = {} -- A, D

local function removeFromStack(stack, key)
	for i = #stack, 1, -1 do
		if stack[i] == key then
			table.remove(stack, i)
		end
	end
end

local function updateStack(stack, key, isPressed)
	removeFromStack(stack, key)
	if isPressed then
		table.insert(stack, key)
	end
end

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	
	if keys[input.KeyCode] ~= nil then
		keys[input.KeyCode] = true
		if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.S then
			updateStack(verticalStack, input.KeyCode, true)
		elseif input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.D then
			updateStack(horizontalStack, input.KeyCode, true)
		end
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if keys[input.KeyCode] ~= nil then
		keys[input.KeyCode] = false
		if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.S then
			updateStack(verticalStack, input.KeyCode, false)
		elseif input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.D then
			updateStack(horizontalStack, input.KeyCode, false)
		end
	end
end)

RunService.RenderStepped:Connect(function()
	if not humanoid or not character:IsDescendantOf(workspace) then return end
	
	-- Handle jumping
	if keys[Enum.KeyCode.Space] then
		humanoid.Jump = true
	end
	
	local moveDir = Vector3.new(0, 0, 0)
	
	-- Vertical movement (Snap Tap)
	if #verticalStack > 0 then
		local activeKey = verticalStack[#verticalStack]
		if activeKey == Enum.KeyCode.W then
			moveDir += Vector3.new(0, 0, -1)
		elseif activeKey == Enum.KeyCode.S then
			moveDir += Vector3.new(0, 0, 1)
		end
	end
	
	-- Horizontal movement (Snap Tap)
	if #horizontalStack > 0 then
		local activeKey = horizontalStack[#horizontalStack]
		if activeKey == Enum.KeyCode.A then
			moveDir += Vector3.new(-1, 0, 0)
		elseif activeKey == Enum.KeyCode.D then
			moveDir += Vector3.new(1, 0, 0)
		end
	end
	
	if moveDir.Magnitude > 0 then
		humanoid:Move(moveDir.Unit, true)
	else
		humanoid:Move(Vector3.new(0, 0, 0), true)
	end
end)

설명

Snap Tap is an advanced movement feature that gives instant priority to the most recently pressed movement key. When two opposite movement keys (such as A and D, or W and S) are held at the same time, the latest key pressed automatically becomes active without requiring the other key to be released. This allows for faster direction changes, smoother movement, and more responsive controls during gameplay. Once the active key is released, control instantly returns to the previously held key.

댓글 (0)

대화에 참여하려면 로그인하세요

  • 첫 댓글을 작성하세요.

자주 묻는 질문

Snap Tap Movement 스크립트는 어떻게 사용하나요?
위의 스크립트 코드를 복사하고, Roblox 엑시큐터를 열어 붙여넣은 후, 게임 중에 실행을 누르세요. 스크립트가 실행되면 기능이 즉시 활성화됩니다.
Snap Tap Movement 스크립트는 무료인가요?
네. 이 스크립트는 무료로 복사하고 사용할 수 있습니다. 키 시스템을 사용하는 경우, 링크를 통해 무료로 키를 받으세요.
Snap Tap Movement 스크립트는 안전한가요?
전체 소스 코드가 이 페이지에 표시되어 실행 전에 정확히 무엇을 하는지 확인할 수 있습니다. 항상 신뢰할 수 있는 엑시큐터를 사용하고, 스크립트 사용은 Roblox 이용 약관에 위반되므로 자의적 위험으로 사용하세요.
Snap Tap Movement에 호환되는 엑시큐터는?
이 스크립트는 대부분의 인기 Roblox 엑시큐터에서 작동합니다. 기기에 맞는 신뢰할 수 있는 무료 또는 유료 엑시큐터를 찾으려면 엑시큐터 페이지를 확인하세요.
Snap Tap Movement | BloxScripter