I'm making a game and I have ran into an error I don't understand Unable to cast string to bool

here's the script:

game.ReplicatedStorage.Remotes.BuyDance.OnServerInvoke = function(plr, Up, Down, Left, Right)

local animation = game.ReplicatedStorage.Animations:FindFirstChild(Up, Down, Left, Right)

if plr.leadersats.Points.Value >= animation.Price.Value then
	if not plr.playerValues.Animations:FindFirstChild(Up, Down, Left, Right) then
		plr.leaderstats.Points.Value -= animation.Price.Value
		
		local valUp = Instance.new('StringValue', plr.Animations)
		local valDown = Instance.new('StringValue', plr.Animations)
		local valLeft = Instance.new('StringValue', plr.Animations)
		local valRight = Instance.new('StringValue', plr.Animations)
		valUp.Name = Up
		valDown.Name = Down
		valLeft.Name = Left
		valRight.Name = Right

		plr.playerValues.UpAnimation = Up
		plr.playerValues.DownAnimation = Down
		plr.playerValues.LeftAnimation = Left
		plr.playerValues.RightAnimation = Right
		
		
		return 'Success'
	else
		plr.playerValues.UpAnimation = Up
		plr.playerValues.DownAnimation = Down
		plr.playerValues.LeftAnimation = Left
		plr.playerValues.RightAnimation = Right
		
		return 'Equip'
	end
else
	return 'Error'
end

end

11 comments

0

Could you take a screenshot of the console?

0

sure

0

I'm kind of new to this website could you tell me how

0

I would use a discord link but i also see people using imgur for screenshots.

0

No, I need a screenshot of the developer console, not the script itself.

0

there it is

0

What is the name of the script? Main_Server or LocalScript?

0

Main_Server

0

This is the local script if you need it: https://i.imgur.com/Ot9kd7Q.png

0

I think what the error means is that your’re trying to change a bool value (true or false) to a string value (“text”)