Visits Goal Board - Source Code

Model:

VisitsGoalBoard.rbxm (7.5 KB)

Server Script:

local HttpService = game:GetService("HttpService")

local VisitsBoard = game.Workspace.VisitsGoal.VisitsGoalBoard:WaitForChild("VisitsGoalGui")
local BoardMiniFrame = VisitsBoard.Main.MiniFrame

local VisitsGoal = 10
local PlaceId = game.PlaceId

local CurrentVisits = 0 

local function GetCurrentVisits()
	local Request = HttpService:GetAsync("https://cookie-tech-blox-api.herokuapp.com/game/visits/?game_id=" .. PlaceId)
	local Respnse = HttpService:JSONDecode(Request)
	CurrentVisits = Respnse
end

local function CalculatePercentage()
	local percentage = math.floor(CurrentVisits / VisitsGoal * 100 + 0.5)
	return percentage
end

local function BoardUpdate()
	GetCurrentVisits()
	wait(3)
	BoardMiniFrame.CurrentGoal.Text = "Current Goal: " .. VisitsGoal
	BoardMiniFrame.CurrentVisits.Text = "Current Visits: " .. CurrentVisits
	BoardMiniFrame.Percentage.Text = CalculatePercentage().. "% of goal completed"
end

BoardUpdate()

while wait(120) do
	BoardUpdate()
end

If you encounter any issues, feel free to make a post in #scripting-support!

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.