Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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

Log in to vote
0
Answered by
brianush1 235 Moderation Voter
7 years ago

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"

Ad

Answer this question