Catálogo/Espada de combate
CombateMedio
Espada de combate
Mete una espada en el StarterPack. Al equiparla, golpear a otro jugador resta vida. Ideal para arenas.
Valores
Dónde va
- 01
Script
Un Script en ServerScriptService crea la tool sola.
- 02
Play
La espada aparece en la hotbar. Equípala y toca a otro personaje.
Explorer → ServerScriptService → Script “Espada”
Espada.luaScript
--[[
Espada de combate · Taller Lua
Pega este Script en ServerScriptService y pulsa Play.
Es para TU juego en Roblox Studio — no es un exploit.
]]
local Players = game:GetService("Players")
local StarterPack = game:GetService("StarterPack")
local DAMAGE = 25
local COOLDOWN = 0.4
local old = StarterPack:FindFirstChild("Espada")
if old then
old:Destroy()
end
local tool = Instance.new("Tool")
tool.Name = "Espada"
tool.CanBeDropped = false
tool.RequiresHandle = true
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Size = Vector3.new(0.35, 4, 0.35)
handle.Color = Color3.fromRGB(168, 172, 180)
handle.Material = Enum.Material.Metal
handle.Parent = tool
local blade = Instance.new("Part")
blade.Name = "Hoja"
blade.Size = Vector3.new(0.28, 3.2, 1.05)
blade.Color = Color3.fromRGB(214, 218, 226)
blade.Material = Enum.Material.Metal
blade.Massless = true
blade.CanCollide = false
blade.CFrame = handle.CFrame * CFrame.new(0, 2.15, 0)
blade.Parent = tool
local weld = Instance.new("WeldConstraint")
weld.Part0 = handle
weld.Part1 = blade
weld.Parent = handle
tool.Parent = StarterPack
local function hook(toolInstance)
if toolInstance:GetAttribute("TallerHooked") then
return
end
toolInstance:SetAttribute("TallerHooked", true)
local h = toolInstance:WaitForChild("Handle")
local lastHit = 0
h.Touched:Connect(function(hit)
if os.clock() - lastHit < COOLDOWN then
return
end
local wielder = toolInstance.Parent
if not wielder or not wielder:FindFirstChildOfClass("Humanoid") then
return
end
if hit:IsDescendantOf(wielder) then
return
end
local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Health > 0 then
lastHit = os.clock()
humanoid:TakeDamage(DAMAGE)
end
end)
end
local function watchContainer(container)
container.ChildAdded:Connect(function(child)
if child:IsA("Tool") and child.Name == "Espada" then
hook(child)
end
end)
for _, child in ipairs(container:GetChildren()) do
if child:IsA("Tool") and child.Name == "Espada" then
hook(child)
end
end
end
local function watchPlayer(player)
watchContainer(player:WaitForChild("Backpack"))
player.CharacterAdded:Connect(function(character)
watchContainer(character)
end)
if player.Character then
watchContainer(player.Character)
end
end
Players.PlayerAdded:Connect(watchPlayer)
for _, player in ipairs(Players:GetPlayers()) do
watchPlayer(player)
end