Hello there.

I am currently working on a Black Clover game, in which people have a "floating" magical book in front of them. I have made the script to make it so the book appears after pressing a certain key, but I am having trouble making the floating book animated while it is summoned. I have tried lerping, which didn't work, as well as utilizing an animation. However, none have worked. How would I go about doing this? (The floating book is not a tool, but I would consider it an instance) Here is the code:

local summonevent = game
ReplicatedStorage:WaitForChild("SummonGrimoire")
wait(1)
local book = game.ReplicatedStorage.books.Grimoire1

summonevent.OnServerEvent:Connect(function(player, value)
	if value == true then
		book:Clone()
		local Character = player.Character
		local root = Character:WaitForChild("HumanoidRootPart")
		local weld = Instance.new("Weld",root)
		weld.Part0 = root
		weld.C0 = CFrame.new(1.8,0,-3) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(0))
		book.Parent = root
		weld.Part1 = book
		local animation = Character.Humanoid:LoadAnimation(script.Idle)
		animation:Play()
		
		
	elseif value == false then
		book.Parent = game.ServerStorage
		
		end
	end)

^^^^This is a server script. Here is the Local Script for your convenience.

local summonevent = game.ReplicatedStorage:WaitForChild("SummonGrimoire")
local UIS = game:GetService("UserInputService")
local summoned = false

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Q then
		if summoned == false then
			summonevent:FireServer(true)
			summoned = true
			
		elseif summoned == true then 
			summonevent:FireServer(false)
			summoned = false
		end
		
	
			
		end	
	end
)

3 comments

0

You CAN animate an object that is welded to you. Use Moon Animator or Blender to accomplish this. Moon Animator is simpler, but blender makes more good animations.

0

^ You have to use a Motor6D instead of a weld though to be able to animate it.

0

so what you are saying is, in the 1st script, instead of creating a weld instance, I should make a motor6d instance, and insert the animation into the scirpt as well?