Hello, and I’m just wanted to make a game that are similar this game
The owner stopped working on this game and said “Obby King is the backbone of the WGS”
WGS is his group. Of course, for some people they want to keep this game updating but the owner don’t want to work on it. So I decided to make a similar game to this.
I’m thinking, how you can make/program the script for progress. Like progress, start from spawn and to the end in Obby Map. I’m thinking a Touched event but do you have any ideas?
Here’s my idea on how you could go with getting the player’s progress:
Start by getting the start and end part’s position.
local StartPart = workspace.StartPart
local EndPart = workspace.EndPart
Get the player’s position every 1/60th of a second using a loop.
local StartPart = workspace.StartPart
local EndPart = workspace.EndPart
while task.wait() do
local position = player.Character:GetPivot()
end
Divide the player’s X position with the end part’s X position and then use a bar to visualize the player’s progress. You can also change this to Y or Z, whatever you’d like to choose, X is only being used as an example here.
local StartPart = workspace.StartPart
local EndPart = workspace.EndPart
while task.wait() do
local position = player.Character:GetPivot()
local progress = (position.X) / (EndPart.Position.X)
if progress < 0 then
script.Parent.Bar.Fill.Size = UDim2.new(0, 0, 1, 0)
elseif progress > 1 then
script.Parent.Bar.Fill.Size = UDim2.new(1, 0, 1, 0)
else
script.Parent.Bar.Fill.Size = UDim2.new(progress, 0, 1, 0)
end
end
Note that the above code snippet only works if the start part is at position 0, 0, 0. If you want the bar to update based on the start and end part’s position, add math.abs(StartPart.Position) to both the player’s position and end part.
local StartPart = workspace.StartPart
local EndPart = workspace.EndPart
while task.wait() do
local position = player.Character:GetPivot()
local progress = (position.X + math.abs(StartPart.Position.X)) / (EndPart.Position.X + math.abs(StartPart.Position.X))
if progress < 0 then
script.Parent.Bar.Fill.Size = UDim2.new(0, 0, 1, 0)
elseif progress > 1 then
script.Parent.Bar.Fill.Size = UDim2.new(1, 0, 1, 0)
else
script.Parent.Bar.Fill.Size = UDim2.new(progress, 0, 1, 0)
end
end
You can use renderstep function to calculate the distance (magnitude) between the player and the finish part, after that try doing some calculations making it count in percentage and if you are trying to link this using a gui you can simply do an incerement to the “Text” value of the TextLabel in your gui! Use tween service to make it smooth!