Quick actions

cmd+k|ctrl+k

Navigation

Languages

totem

Snippet info

Language

Lua

Visibility

public

Author

lazarovalkyrie

Created

2024-05-03T04:10:56.688031Z

Updated

2024-05-04T20:24:32.222432Z


warn([[
LazaroValkyrie's Totem
G - Auto equip (true by default)
]])

local totem = nil
local left = 10
local oldchar = nil
local auto = true
local oldpos = CFrame.new()

local remote = Instance.new("RemoteEvent")
remote.Name = "KrY's Totem"
remote.Parent = owner['PlayerGui']

local code = [[
local plr = game:GetService("Players").LocalPlayer
local remote = script.Parent
local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(input,press)
	if press then return end
	if input.UserInputType == Enum.UserInputType.Keyboard then
		local key = input.KeyCode
		
		if key == Enum.KeyCode.G then
        	remote:FireServer()
       	end
    end
end)
]]

NLS(code,remote)

remote.OnServerEvent:Connect(function(plr)
	auto = not auto
end)

function effect(p,h)
	local Part0 = Instance.new("Part")
	local ParticleEmitter1 = Instance.new("ParticleEmitter")
	Part0.Name = "effects"
	Part0.Parent = p
	Part0.CFrame = CFrame.new(-5.20499992, 2.68487453, -24.0999928, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	Part0.Position = Vector3.new(-5.20499992, 2.68487453, -24.0999928)
	Part0.Transparency = 1
	Part0.Size = Vector3.new(2.39999962, 5.17000914, 0.970000446)
	Part0.BottomSurface = Enum.SurfaceType.Smooth
	Part0.TopSurface = Enum.SurfaceType.Smooth
	Part0.Anchored = false
	Part0.CanCollide = false
	Part0.CanQuery = false
	ParticleEmitter1.Parent = Part0
	ParticleEmitter1.Speed = NumberRange.new(2, 2)
	ParticleEmitter1.Color = ColorSequence.new(Color3.new(0.666667, 0, 0),Color3.new(1, 0, 0),Color3.new(0.309804, 1, 0.898039))
	ParticleEmitter1.LightEmission = 0.80000001192093
	ParticleEmitter1.Texture = "http://www.roblox.com/asset/?id=241650934"
	ParticleEmitter1.Size = NumberSequence.new(1,0)
	ParticleEmitter1.Lifetime = NumberRange.new(1, 1)
	ParticleEmitter1.LockedToPart = true
	ParticleEmitter1.Rate = 250
	ParticleEmitter1.SpreadAngle = Vector2.new(45, 45)
	ParticleEmitter1.VelocitySpread = 45
	local tempweld = Instance.new("Weld")
	tempweld.Parent = Part0
	tempweld.Part0 = p
	tempweld.Part1 = Part0
	tempweld.C0 = p.CFrame:Inverse()
	tempweld.C1 = Part0.CFrame:Inverse()
	tempweld.C0 = CFrame.new(0,0,0)
	task.spawn(function()
		ParticleEmitter1.Enabled = true
		wait(1)
		ParticleEmitter1.Rate = 100
		wait(.5)
		ParticleEmitter1.Rate = 50
		wait(.5)
		ParticleEmitter1.Rate = 0
		wait(2)
		Part0:Destroy()
		tempweld:Destroy()
		ParticleEmitter1.Enabled = false
	end)
end

function spawntotem()
	local plr = owner
	local char = plr.Character
	local torso = char:FindFirstChild("HumanoidRootPart")
	local hum = char:FindFirstChildOfClass("Humanoid")
	local holding = auto
	local died = false

	local function alive()
		local alive = false
		if char and char.Parent and torso and torso.Parent and hum and hum.Parent and hum.Health > 0 then
			alive = true
		end
		return alive
	end

	local function rebirth()
		hum.BreakJointsOnDeath = false
		plr:LoadCharacter()
		repeat wait() until plr.Character
		char = plr.Character
		torso = char:FindFirstChild("HumanoidRootPart")
		hum = char:FindFirstChildOfClass("Humanoid")
		local ff = char:FindFirstChildOfClass("ForceField")
		hum.Health = 20
		if ff then
			ff:Destroy()
		end
		if torso then
			torso.Velocity = Vector3.new()
			torso.CFrame = oldpos
		end
		if hum then
			hum.Sit = false
			hum.PlatformStand = false
			hum:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
			hum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
		end
		task.spawn(function()
			local o1 = Instance.new("Part")
			local o2 = Instance.new("ParticleEmitter")
			o1.Name = "effects"
			o1.Parent = char
			o1.CanCollide = false
			o1.CanQuery = false
			o1.Transparency = 1
			o1.Rotation = Vector3.new(0.0500000007, 0, -0.0199999996)
			o1.Size = Vector3.new(2.39999962, 5.17000914, 0.970000446)
			o1.CFrame = CFrame.new(-0.00269600004, 2.58585, 0.00243000011, 0.99999994, 0.000345684297, 6.2623044e-06, -0.000345678796, 0.999999583, -0.000859424355, -6.5593913e-06, 0.000859422144, 0.999999642)
			o1.BottomSurface = Enum.SurfaceType.Smooth
			o1.TopSurface = Enum.SurfaceType.Smooth
			o2.Parent = o1
			o2.Size = NumberSequence.new(0.74999988079071,0.5,0)
			o2.Color = ColorSequence.new(Color3.new(0.666667, 0.666667, 0.666667),Color3.new(0.666667, 0.666667, 0.666667))
			o2.LightEmission = 0.80000001192093
			o2.Texture = "rbxassetid://3552571288"
			o2.Lifetime = NumberRange.new(2,2)
			o2.Rate = 1
			o2.RotSpeed = NumberRange.new(270,270)
			o2.Speed = NumberRange.new(1.5,1.5)
			o2.VelocitySpread = 45
			o2.Color = ColorSequence.new(Color3.new(0.666667, 0.666667, 0.666667),Color3.new(0.666667, 0.666667, 0.666667))
			local tempweld2 = Instance.new("Weld")
			tempweld2.Parent = o1
			tempweld2.Part0 = torso
			tempweld2.Part1 = o1
			game:GetService("Debris"):AddItem(o1,7)
			local regen = true
			task.spawn(function()
				while regen and (hum.Health > 0) do
					wait(0.25)
					hum.Health = hum.Health + 5
				end
			end)
			wait(5)
			regen = false
		end)
		task.spawn(function()
			local o1 = Instance.new("Part")
			local o2 = Instance.new("Attachment")
			local o3 = Instance.new("ParticleEmitter")
			local o4 = Instance.new("ParticleEmitter")
			o1.Parent = workspace
			o1.Transparency = 1
			o1.Anchored = true
			o1.CanCollide = false
			o1.CanQuery = false
			o1.Size = Vector3.new(25, 1, 25)
			o1.Position = oldpos.Position - Vector3.new(0,2.5,0)
			o1.BottomSurface = Enum.SurfaceType.Smooth
			o1.TopSurface = Enum.SurfaceType.Smooth
			o2.Parent = o1
			o3.Parent = o2
			o3.Size = NumberSequence.new(0.24999976158142,0.37499964237213,0)
			o3.Color = ColorSequence.new(Color3.new(0.333333, 1, 0),Color3.new(0.333333, 1, 0),Color3.new(0, 0.666667, 0),Color3.new(0, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0.519689, 1, 0.139219),Color3.new(1, 0.333333, 0),Color3.new(1, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0, 1, 0),Color3.new(1, 0.666667, 0),Color3.new(1, 1, 0.498039))
			o3.LightEmission = 0.75
			o3.Texture = "rbxassetid://2434785466"
			o3.Acceleration = Vector3.new(0, -25, 0)
			o3.Lifetime = NumberRange.new(3,3)
			o3.Rate = 300
			o3.Speed = NumberRange.new(25,25)
			o3.VelocitySpread = 45
			o3.Color = ColorSequence.new(Color3.new(0.333333, 1, 0),Color3.new(0.333333, 1, 0),Color3.new(0, 0.666667, 0),Color3.new(0, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0.519689, 1, 0.139219),Color3.new(1, 0.333333, 0),Color3.new(1, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0, 1, 0),Color3.new(1, 0.666667, 0),Color3.new(1, 1, 0.498039))
			o4.Parent = o1
			o4.Size = NumberSequence.new(0.24999976158142,0.37499964237213,0)
			o4.Color = ColorSequence.new(Color3.new(0.333333, 1, 0),Color3.new(0.333333, 1, 0),Color3.new(0, 0.666667, 0),Color3.new(0, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0.519689, 1, 0.139219),Color3.new(1, 0.333333, 0),Color3.new(1, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0, 1, 0),Color3.new(1, 0.666667, 0),Color3.new(1, 1, 0.498039))
			o4.LightEmission = 0.75
			o4.Texture = "rbxassetid://2434785466"
			o4.Lifetime = NumberRange.new(3,3)
			o4.Rate = 100
			o4.Speed = NumberRange.new(0,0)
			o4.Color = ColorSequence.new(Color3.new(0.333333, 1, 0),Color3.new(0.333333, 1, 0),Color3.new(0, 0.666667, 0),Color3.new(0, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0.519689, 1, 0.139219),Color3.new(1, 0.333333, 0),Color3.new(1, 1, 0),Color3.new(0.333333, 1, 0.498039),Color3.new(0, 1, 0),Color3.new(1, 0.666667, 0),Color3.new(1, 1, 0.498039))
			local sound = Instance.new("Sound")
			sound.Parent = o1
			sound.SoundId = "rbxassetid://3552283822"
			sound.Volume = 1.5
			sound:Play()
			wait(2)
			o4.Enabled = false
			o3.Enabled = false
		end)
		--effect(torso,hum)
		spawntotem()
	end

	totem = Instance.new("Tool")
	local o2 = Instance.new("Part")
	local o3 = Instance.new("Decal")
	local o4 = Instance.new("Decal")
	local o5 = Instance.new("Part")
	totem.Name = "Totem of Undying"
	totem.Parent = plr.Backpack
	o2.Name = "part"
	o2.Parent = totem
	o2.Transparency = 1
	o2.Rotation = Vector3.new(-82.4100037, 1.04999995, 17.8500004)
	o2.Size = Vector3.new(0.600000024, 0.0500000007, 1.25)
	o2.CFrame = CFrame.new(14.8800182, 0.663631022, 12.8549995, 0.951727092, -0.306400239, 0.01828775, 0.0232320018, 0.131314978, 0.991068482, -0.306065023, -0.942801833, 0.132094339)
	o2.BottomSurface = Enum.SurfaceType.Smooth
	o2.TopSurface = Enum.SurfaceType.Smooth
	o3.Parent = o2
	o3.Texture = "rbxassetid://3551524140"
	o3.Face = Enum.NormalId.Top
	o4.Parent = o2
	o4.Texture = "rbxassetid://3551524140"
	o4.Face = Enum.NormalId.Bottom
	o5.Name = "Handle"
	o5.Parent = totem
	o5.Transparency = 1
	o5.Rotation = Vector3.new(-68.7200012, 5.36999989, -29.9599991)
	o5.Size = Vector3.new(0.100000001, 0.100000001, 0.100000001)
	o5.CFrame = CFrame.new(14.9258261, 0.462755978, 12.3108463, 0.862572074, 0.497210532, 0.0935470909, -0.256796867, 0.270954847, 0.927706182, 0.435918272, -0.824236095, 0.361400247)
	o5.BottomSurface = Enum.SurfaceType.Smooth
	o5.TopSurface = Enum.SurfaceType.Smooth

	for i,v in pairs(totem:GetDescendants()) do
		if v:IsA("Part") then
			v.CanCollide = false
			v.Massless = true
		end
	end

	totem.CanBeDropped = false

	local w1 = Instance.new("Weld")
	w1.Parent = o5
	w1.Part0 = o5
	w1.Part1 = o2
	w1.C0 = o5.CFrame:Inverse()
	w1.C1 = o2.CFrame:Inverse()
	w1.C0 = CFrame.new(-15,0.2,-12.6)

	task.spawn(function()
		while not died do
			game:GetService("RunService").Heartbeat:Wait(1/30)
			if alive() then
				oldpos = torso.CFrame
			end
			if totem and auto then
				totem.Parent = char
			end
			if not alive() then
				died = true
			end
			if not alive() and (holding or auto) and (left > 0) then
				left = left - 1
				rebirth()
			end
		end
	end)

	totem.Unequipped:Connect(function()
		holding = false
	end)

	totem.Equipped:Connect(function()
		holding = true
	end)
end

spawntotem()
INFO