Problem with making achievements

  1. What do you want to achieve? Keep it simple and clear!
    I’m making an achievements system, where for completing an achievement you get a boost. It should work but
  2. What is the issue? Include screenshots / videos if possible!
    Exactly when i have Progress 100%, i click Achieve button and it do nothing, idk why
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I didn’t find anything on yt or dev hub about it

Code which fires button:

local Button = script.Parent
local RemoteEvents = workspace.RemoteEvents
local AchieveEvent = RemoteEvents.AchieveEvent
local Player = game.Players.LocalPlayer
local TotalCoal = Player.TotalFolder.TotalCoal
local Ach4Goal = Player.Stats.Ach4Goal
local Progress = (TotalCoal.Value/Ach4Goal.Value) * 100
local Bar = script.Parent.Parent.Parent.ProgressBar.Bar
if Progress >= 100 then
	AchieveEvent:FireServer(Progress, "CoalAchievement")
	end

Code which gives new achievement level:

local RemoteEvents = workspace.RemoteEvents
local AchieveEvent = RemoteEvents.AchieveEvent
AchieveEvent.OnServerEvent:Connect(function(player, ClientProgress, AchName)
	local TotalCoal = player.TotalFolder.TotalCoal
	local Ach4Goal = player.Stats.Ach4Goal
	local Ach4Boost = player.Stats.Ach4Boost
	local Ach4Level = player.Stats.Ach4Level
	if AchName == "CoalAchievement" then
	local Progress = (TotalCoal.Value/Ach4Goal.Value) * 100
	if Progress >= 100 then
		if ClientProgress == Progress then
				Ach4Boost.Value *= 1.05
				Ach4Level.Value += 1
		else
			player:Kick("You got kicked for invoking an illegal function! Your account has been flagged!")
		end
		end
		end
end)

This is running once at the beginning of your script when, I am assuming, Progress does not equal 100. Try adding a click event.

1 Like