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

How to make a Touch event detect Player.leaderstats.Coins.Value not working?

Asked by 4 years ago

Well i have been trying to make a OnTouch function that detects if the player have the ammount of shards but instead of working he is making the same error all over again. it doesn't matter if i have the necessary Value or dont have any shard he do the same print i have been using this command, tell me what i made wrong and if i made it work correctly

function onTouched(hit)
    if hit then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player.leaderstats.Shards.Value <= 6 then
            print("1")
        elseif player.leaderstats.Shards.Value >= 5 then 
            print("2")
        end
    end
end
script.Parent.Touched:Connect(onTouched)

at " if.player.leaderstats.Shards.Value <= 6" i want to him detect if player have the ammount or higher and if have print("1") and if he have a value equal 5 or lower he print("2") but doesn't matter if my value is 5 or lower or higher than 6 he keep printing "1" all the time, what im doing wrong?

1 answer

Log in to vote
0
Answered by 4 years ago

For your information < mean less than and > means more than. You got it messed up in your code.

0
Thanks so much Xviperlink didn't notice that pingopingo2 2 — 4y
Ad

Answer this question