I have another problem now. The pointer starts all the on the left side of the script instead of the beggining of the slider:
Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local TFM = require(ReplicatedStorage.TFM)
local backgroundMusic = game.Workspace:WaitForChild("BackgroundMusic")
local pointer = script.Parent
local songLengthLine = script.Parent.Parent:WaitForChild("SongLengthLine")
local startPosition = UDim2.new(0.389, 0,0.287, 0)
local endPosition = UDim2.new(0.61, 0,0.285, 0)
local lineLength = 0.227
local oldTimePosition = backgroundMusic.TimePosition -- initial
local MAX_X = 0.61
--Script
local function getSliderX(song)
local scale = song.TimePosition / song.TimeLength
return MAX_X * scale
end
RunService.RenderStepped:Connect(function()
if backgroundMusic.TimePosition == 0 then
end
pointer.Position = UDim2.new(getSliderX(backgroundMusic),0,0.285,0)
end)
