'Unable to cast to Bool'

Hello! I am currently trying to make a “Combine item” system for my game, but I always get an error every time I input the first item to mix. I’ve been trying to change all the :FindFirstChildOfClass() Stuff and all that, but nothing worked. Please help!

Heres my code:

local UserInputService = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer

local CombineList = {
First_Item = {},
Second_Item = {}
}

local function CombineItem()
	Narration.TextLabel.Text = "[Equip the first item you want to combine.]"
	TweenService:Create(Narration.TextLabel,TweenInfo.new(0.5,Enum.EasingStyle.Sine),{BackgroundTransparency = 0.5,TextTransparency = 0}):Play()
	repeat wait() until Player.Character:FindFirstChildWhichIsA("Tool")
	wait(1)
	CombineList.First_Item = Player.Character:FindFirstChildWhichIsA("Tool").Name
	for _, t in pairs(Player.Character:GetChildren()) do
		if t.ClassName == "Tool" then
		game.ReplicatedStorage.Remotes.MoveItem:FindFirstChild(t,script.Parent.CombineList)
		end
	end
	wait(0.3)
	Narration.TextLabel.Text = "[Equip the second item you want to combine.]"
	TweenService:Create(Narration.TextLabel,TweenInfo.new(0.5,Enum.EasingStyle.Sine),{BackgroundTransparency = 0.5,TextTransparency = 0}):Play()
	repeat wait() until Player.Character:FindFirstChildWhichIsA("Tool")
	wait(1)
	CombineList.Second_Item = Player.Character:FindFirstChildWhichIsA("Tool").Name
	for _, re in pairs(Player.Character:GetChildren()) do
		if re:IsA("Tool") then
		game.ReplicatedStorage.Remotes.MoveItem:FindFirstChild(re,script.Parent.CombineList)
		end
	end
	wait(0.3)
end

The error I get:

  15:11:55.715 - Unable to cast Instance to bool
15:11:55.717 - Stack Begin
15:11:55.718 - Script 'Players.DokuDako.PlayerGui.Events.LocalScript', Line 98 - function CombineItem
15:11:55.718 - Script 'Players.DokuDako.PlayerGui.Events.LocalScript', Line 118
15:11:55.719 - Stack End

A video showcasing the error:


If anyone can help, thanks!

1 Like

This may be the issue:

game.ReplicatedStorage.Remotes.MoveItem:FindFirstChild(re,script.Parent.CombineList)

Now look at this:

You are assigning an Instance to a bool (second parameter) which is why it’s error-ing, I believe.

3 Likes

Oh wait, I messed up the code haha.
I was originally supposed to do :FireServer() Since it’s on client. Uh oh.
Well, thanks for your help!

1 Like