Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this error happening? Is there an alternate way to do it?

Here's the code:

Cooldown = 1

CTorso = game.Players.LocalPlayer.Character.Torso

function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.T then
		if game.Players.LocalPlayer.leaderstats.Level > 3 then
			TorsoParticles = Instance.new("Particle Emitter", CTorso)
			TorsoParticles.Color = ColorSequence.new(Color3.fromRGB(255, 70, 14))
			TorsoParticles.Lifetime = NumberRange.new(0.1, 0.5)
			TorsoParticles.Size = NumberSequence.new(5)
			TorsoParticles.LockedToPart = true
			TorsoParticles.Speed = NumberRange.new(5)
			TorsoParticles.Rate = 20
		else
			print("Wrong Level")
		end
	end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

Error: Pyro Moves:40: attempt to compare number with userdata

1 answer

✓ Accepted answer

It's a simple mistake, where on line 7 of the code you posted, you used "game.Players.LocalPlayer.leaderstats.Level" However, it was supposed to be "game.Players.LocalPlayer.leaderstats.Level.Value"

This discussion is preserved as it was. New answers, comments, and votes are closed.