You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I am attempting to make a time tracking system to track a players time in game and use each second in game as a sort of point, and you can check these points via a proxmity prompt that pulls up a basic GUI.
-
What is the issue? The code that actually manages the GUI doesnt work, and its not very much code so im not sure why. There are no errors that I can find, even when testing in an empty baseplate. The main issue I think is with the .Changed event, as it doesnt seem to be firing.
-
What solutions have you tried so far? Using developer hub, youtube, and the api documenation.
I can confirm that the TimeValue object referenced is there when the script attempts to reference it, and that there are no issues that stem from the script not finding the TimeValue object.
script.Parent.ProximityPrompt.Triggered:Connect(function(playerWhoTriggered)
local newClone = script.ExperienceView:Clone()
local givenValue
--(correctedStartValue * 1) / range
playerWhoTriggered.TimeValue.Changed:Connect(function(e) -- Time value is the value that tracks seconds in game, this is where I think it is failing.
print("aypo")
givenValue = e
local newValue = (givenValue * 1) / 900 -- Calculate percentage for udim2
print(newValue)
newClone.ProgressBar.ProgressionBar.Size = UDim2.new(newValue, 0, 1, 0) -- sets size
local remaining = 900 - newValue -- how much time needed for next rank
newClone.Remaining.Text = tostring(remaining) -- converts said time into string form
end)
newClone.Parent = playerWhoTriggered.PlayerGui -- sets gui parent to player
end)