So i am trying to make a wall appear if you have 20 (Tokens) or more But it dosent work. Idn if it is because im not actully accsessing the leaderstats
Code:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("leaderstats") and
hit.Parent.leaderstats.Tokens.Value >= 20 then
workspace.Wall.Transparency = 0
workspace.Wall.CanCollide = true
wait(0.5)
script.Parent:Destroy()
else
game.StarterGui.ScreenGui.Buy_Twenty_Tokens.Visible = true
end
end)

2 comments
Where do you store your leaderstats? It looks like you are searching for leaderstats inside the character and not the actual player. Since FindFirstChild returns nil since it can't find the leaderstats, it will just skip the rest.
How do you acsess the localplayer trough a regular script?