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

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

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

✓ Accepted answer

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

1 comment

0

Thanks so much Xviperlink didn't notice that

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