So my script is not working. I want to know what I should do differently, and why it isn’t working.
My local script:
local player = game.Players.LocalPlayer
script.Parent.Progress.Text = player.Achievements["Cocoa Collecting 1"].Value.." / 20"
while wait(1) do
if player.Achievements["Cocoa Collecting 1"].Value >= script.Parent.Max.Value then
script.Parent.Progress.Text = "Achievement Completed!"
elseif player.Achievements["Cocoa Collecting 1"].Value < script.Parent.Max.Value then
script.Parent.Progress.Text = player.Achievements["Cocoa Collecting 1"].Value.." / 20"
else
warn("Something happened")
end
end
My script:
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
if player ~= nil then
if player.Achievements["Cocoa Collecting 1"].Value >= script.Parent.Max.Value then
script.Parent.Completed.Value = true
player.leaderstats.Crystals.Value = player.leaderstats.Crystals.Value + 10
local playerMoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if playerMoney ~= nil then
playerMoney.Value = playerMoney.Value + 1000
end
end
end
What is wrong? Should I use events? Thank you for helping out.
edit: What is wrong is:
- script (not local) doesn’t seem to be working
- nothing comes in the output when I added a print function to see if it worked