local part = script.Parent
game.Players.PlayerAdded:Connect(function(player)
if player.leaderstats.Credits.Value >= 500 then
wait()
print ("you reached")
part.CanCollide = false
part.Transparency = 1
end
end)
local part = script.Parent
game.Players.PlayerAdded:Connect(function(player)
if player.leaderstats.Credits.Value >= 500 then
wait()
print ("you reached")
part.CanCollide = false
part.Transparency = 1
end
end)
local part = script.Parent
game.Players.PlayerAdded:Connect(function(player)
if player.leaderstats.Credits.Value <= 500 then
wait()
print ("you reached")
part.CanCollide = false
part.Transparency = 1
end
@1bitPro didnt work :/
:( sorry
hold on...
okay thank you for your time
There is some small minor issues that needs fixing: 1. If the leaders tats doesn't exist then the whole if statement won't work also. You need to provide and else or the script won't error.
while true do
wait()
local part = script.Parent
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new( "Folder",player)
stats.Name= "leaderstats"
local Credits = Instance.new( "IntValue",stats)
Credits.Name = "Credits"
if player.leaderstats.Credits.Value >= 500 then
wait()
print ("you reached")
part.CanCollide = false
part.Transparency = 1
else
print ( "Error")
end
end
end
wouldn't that over write the leaderstats I already made?
No simply delete the leaderstats script that you made because the server doesnt know what leaderstat your talking about so make sure its in the same script
Also make sure to accept
my leaderstats got DataStore though
And make sure you use a while e server constantly checks to see if you have 500 credits
Then paste the datastore and delete the leaderstats
Copy the one that i made
This discussion is preserved as it was. New answers, comments, and votes are closed.
11 comments
what
does it print in the output
it doesnt not
the only thing that might be stopping the if statement is that the player has less than 500 stats
When you join the game, do you have 500 credits? [without changing nothing after the load]
i set it equal to 0 and it still didnt print
no i start with 0
Problem found, you need to run this on a loop to work
a while loop? and the original script or another one
place lines 3 - 7 on a while loop, and remove the PlayerAdded event, it will work
Player isnt defined then