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

What's wrong with this script? (Why is it not giving the tool if player has the in-game Tix?)

Asked by
ElBamino 153
2 years ago

Hey scriptinghelpers, why isn't my script working? I'm getting the print that says "The user does not have the Tix" when the player indeed does have the Tix. I tried a few different things, I'm not really sure why it's not working. I would really appreciate the help! Thanks in advance and, sorry to bother you with such a simple question. I just can't figure it out.

My code below This is a Script inside of ServerScriptStorage.

local replicatedstorage = game:GetService("ReplicatedStorage")
local tool = replicatedstorage:FindFirstChild("Ghost")

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if player.leaderstats.Tix.Value >= 1000000 then
            tool:Clone().Parent = player:WaitForChild("Backpack")
        else
            print("The user does not have the Tix")
        end
    end)
end)

Thanks again!

1 answer

Log in to vote
0
Answered by 2 years ago

if your getting the print, then

player.leaderstats.Tix.Value >= 1000000

is false.

Where is

player.leaderstats.Tix.Value

being set such that it's greater than or equal to 1000000?

You should print

player.leaderstats.Tix.Value

before the if statement to see what that value is

Ad

Answer this question