Kembali

Refresh Character Command

lua Uploaded by Neo 8 views 03 Jun 2026

Script Refresh Character Command ini memungkinkan player menggunakan command /re untuk me-refresh karakter tanpa harus reset manual. Setelah karakter di-refresh, player akan tetap berada di posisi terakhir sehingga tidak kembali ke spawn. Command /re juga tidak akan muncul di chat karena menggunakan sistem TextChatCommand dari Roblox TextChatService. Cocok untuk map hangout, roleplay, obby, club, lobby, dan game Roblox yang membutuhkan fitur refresh karakter cepat tanpa mengganggu chat publik.

Refresh Character Command LUA
--[[
	Refresh Character Command (/re)
	Author  : NEOBLOX
	License : MIT

	Description:
	Command /re untuk refresh karakter player tanpa menampilkan command di chat.
	Player akan respawn/refresh dan tetap berada di posisi terakhir.

	Place:
	ServerScriptService > Script

	Note:
	Script ini menggunakan TextChatService TextChatCommand,
	jadi command /re tidak akan muncul sebagai pesan chat biasa.
]]

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

local COMMAND_NAME = "RefreshCharacterCommand"
local COMMAND_ALIAS = "/re"

-- Buat command jika belum ada
local refreshCommand = TextChatService:FindFirstChild(COMMAND_NAME)

if not refreshCommand then
	refreshCommand = Instance.new("TextChatCommand")
	refreshCommand.Name = COMMAND_NAME
	refreshCommand.PrimaryAlias = COMMAND_ALIAS
	refreshCommand.SecondaryAlias = ""
	refreshCommand.AutocompleteVisible = false
	refreshCommand.Parent = TextChatService
end

local function refreshCharacter(player)
	if not player or not player.Character then
		return
	end

	local oldCharacter = player.Character
	local oldRoot = oldCharacter:FindFirstChild("HumanoidRootPart")

	if not oldRoot then
		return
	end

	-- Simpan posisi terakhir player
	local savedCFrame = oldRoot.CFrame

	-- Refresh character
	player:LoadCharacter()

	-- Tunggu character baru muncul
	local newCharacter = player.Character or player.CharacterAdded:Wait()
	local newRoot = newCharacter:WaitForChild("HumanoidRootPart", 10)

	if newRoot then
		-- Balikin ke posisi sebelum refresh
		newCharacter:PivotTo(savedCFrame)
	end
end

refreshCommand.Triggered:Connect(function(textSource, unfilteredText)
	local player = Players:GetPlayerByUserId(textSource.UserId)

	if player then
		refreshCharacter(player)
	end
end)