Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.2 kB
4
Indexable
Never
local functions = {}

function functions.loadweapon(player,swordname,class)
	
	local UIS = game:GetService("UserInputService")
	local char = player.Character
	local hum = char:WaitForChild("Humanoid")
	
	game.ServerStorage.weapons[swordname]:clone().Parent = char.RightHand

	local weld = Instance.new("Motor6D",char.RightHand) 

	weld.C0 = CFrame.new(0.034, 0.041, -0.203) * CFrame.Angles(-0,math.rad(-90),math.rad(90))
	weld.Part0 = char.RightHand
	weld.part1 = char.RightHand[swordname].handler
	
	--- Animations ---
	-- Ultra-Greatsword
	if class == "ultragreatsword" then
		-- Idle --
		char.Animate.idle.Animation1.AnimationId = "rbxassetid://13946657032"
		char.Animate.idle.Animation2.AnimationId = "rbxassetid://13946657032"

		-- Walk --
		char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://13946659315"

		--Run --
		char.Animate.run.RunAnim.AnimationId = "rbxassetid://13946659315"
		
		-- Attack --
		UIS.InputBegan:Connect(function(Input)
			
			if Input.KeyCode == Enum.KeyCode.MouseButton1 then
				local animation1 = game.StarterPack.animations.ultragreatsword.common.lightattack1
				local attackanim = hum:LoadAnimation(animation1)
				animation1:Play()
			end
		end)
		
	end
end