I need help making a hat shop

Basically i have a hat sitting on a podium but i need help making it so when i click it it checks if i have at least 1 win on the leaderboard and if not it doesn’t put it on my character and if i do have 1 or more wins it puts it on my character.

1 Like

A good start is using ClickDetectors and hooking it up to a function that will run what you want it to do. If you get stuck using the Instance post about it after.

well my thing is i don’t really know how to script things like what i need

is the win thing a LeaderStat? you can try using if and then

yes the win stat is a leaderstat

try using

if game.Players.LocalPlayer.leaderstats.Win.Value >= 1
then
--put ur hat giving script here
end

Ah okay so if you look inside the resources I sent in the ClickDetector, there’s a starter template script for you to use the click detector.

The function you want to :Connect() is one that accesses your leaderboard. Assuming you’re using leaderstats then use:

local clickDetector = path.to.ClickDetector

clickDetector.MouseClick:Connect(function(player)
   local leaderstat = player.leaderstat.Wins.Value
   if leaderstat >= 1 then 
      print "Wins over 1"
   end
end)
1 Like

it should be >= because the player can have 1 win

1 Like

thanks soooo much i cant stress how much time i have spent looking for help

2 Likes