Skip to content

Instantly share code, notes, and snippets.

@mojombo
Created July 20, 2008 15:20
Show Gist options
  • Select an option

  • Save mojombo/19 to your computer and use it in GitHub Desktop.

Select an option

Save mojombo/19 to your computer and use it in GitHub Desktop.
class Bar
def self.class_name
name.split(/::/)
end
end
loop { Bar.class_name }

ghost commented Oct 27, 2015

Copy link
Copy Markdown

This part requires a bit more thought because it’s easier to choose a theme now than to update your theme later. When you’ve looked at some of the options at the top of the page and ,,

@chhitizlimbu-lang

Copy link
Copy Markdown

  1. _under _

@chhitizlimbu-lang

Copy link
Copy Markdown
<script src="https://gist.github.com/mojombo/19.js"></script>

@xubl7941-dot

Copy link
Copy Markdown

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

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

-- ตัวแปรสถานะ
local isNoclip = false
local isFlying = false
local flySpeed = 50
local bodyVelocity = nil
local bodyGyro = nil

-- 1. ฟังก์ชันวิ่งเร็ว
local function setSpeed(speed)
humanoid.WalkSpeed = speed
end

-- 2. ฟังก์ชันเดินทะลุกำแพง (Noclip)
RunService.Stepped:Connect(function()
if isNoclip and character then
for _, part in pairs(character:GetDescendants()) do
if part:IsA("BasePart") then
part.CanCollide = false
end
end
end
end)

-- 3. ฟังก์ชันระบบบิน (Fly)
local function toggleFly()
isFlying = not isFlying
if isFlying then
bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.MaxForce = Vector3.new(1, 1, 1) * 10^6
bodyVelocity.Velocity = Vector3.new(0, 0, 0)
bodyVelocity.Parent = rootPart

	bodyGyro = Instance.new("BodyGyro")
	bodyGyro.MaxTorque = Vector3.new(1, 1, 1) * 10^6
	bodyGyro.CFrame = rootPart.CFrame
	bodyGyro.Parent = rootPart

	humanoid.PlatformStand = true
else
	if bodyVelocity then bodyVelocity:Destroy() end
	if bodyGyro then bodyGyro:Destroy() end
	humanoid.PlatformStand = false
end

end

-- ควบคุมการบินตามทิศทางกล้อง
RunService.RenderStepped:Connect(function()
if isFlying and bodyVelocity and bodyGyro then
local camera = workspace.CurrentCamera
bodyGyro.CFrame = camera.CFrame
bodyVelocity.Velocity = camera.CFrame.LookVector * flySpeed
end
end)

-- 4. ฟังก์ชันผลักผู้เล่นใกล้เคียงให้กระเด็น (Knockback Push)
local function pushNearbyPlayers()
local pushRadius = 15
local pushForce = 100

for _, otherPlayer in pairs(Players:GetPlayers()) do
	if otherPlayer ~= player and otherPlayer.Character and otherPlayer.Character:FindFirstChild("HumanoidRootPart") then
		local targetRoot = otherPlayer.Character.HumanoidRootPart
		local distance = (targetRoot.Position - rootPart.Position).Magnitude

		if distance <= pushRadius then
			local direction = (targetRoot.Position - rootPart.Position).Unit
			targetRoot.Velocity = direction * pushForce + Vector3.new(0, 30, 0)
		end
	end
end

end

-- การคุมปุ่มคีย์บอร์ด (Keybinds)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end

-- กด Shift ค้างเพื่อวิ่งเร็ว
if input.KeyCode == Enum.KeyCode.LeftShift then
	setSpeed(40)
-- กด F เพื่อเปิด/ปิด บิน
elseif input.KeyCode == Enum.KeyCode.F then
	toggleFly()
-- กด N เพื่อเปิด/ปิด เดินทะลุกำแพง
elseif input.KeyCode == Enum.KeyCode.N then
	isNoclip = not isNoclip
-- กด E เพื่อผลักคนที่อยู่ใกล้ๆ ให้กระเด็น
elseif input.KeyCode == Enum.KeyCode.E then
	pushNearbyPlayers()
end

end)

UserInputService.InputEnded:Connect(function(input)
-- ปล่อย Shift เพื่อกลับความเร็วปกติ
if input.KeyCode == Enum.KeyCode.LeftShift then
setSpeed(16)
end
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment