Hi, im working on a game where the player has a numbrvalue named “Zoom”, it gets bigger by walking on the baseplate.
the players humaniods walkspeed is the players zoom value*0.5.
here is the hierarchy:
that script isn’t working very well.
What I want the script to do is check the players math.floor zoom value every time it changes, and clone the frames named after the digits in CloneChar and parent the clones under MainFrame. Then destroy the frames from the previous “set”.
i have the players zoom set to 32 ( it is 32 so the players walkspeed is 16). but I dont want the the gui to display “32” or “16” when the player joins, i want it to say “0”.
say the players zoom is 25.234, becasue of math.floor it should end up being around 25.2. then the script clones the frames under CloneChars with the names
"2", "5", "." and "2"
and parents them under MainFrame that is a set. I tried using AI do do this and it gave me this script:
-- Variables
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local zoomGui = playerGui:WaitForChild("ZoomGui")
local parentFrame = zoomGui:WaitForChild("ParentFrame")
local mainFrame = parentFrame:WaitForChild("MainFrame")
local cloneChars = parentFrame:WaitForChild("CloneChars")
local zoomValue = player:WaitForChild("Zoom") -- Assuming the Zoom value is a child of the player
-- Function to update the GUI based on the zoom value
local function updateZoomGui()
-- Clear existing clones
for _, child in ipairs(mainFrame:GetChildren()) do
if child.Name ~= "KEEP" then
child:Destroy()
end
end
-- Get the string representation of the zoom value with one decimal place
local zoomString = string.format("%.1f", zoomValue.Value)
-- Clone and parent frames based on the digits in the zoom string
for i = 1, #zoomString do
local char = zoomString:sub(i, i)
if char ~= "." then
local clone = cloneChars:WaitForChild(char):Clone()
clone.Parent = mainFrame
else
-- Handle the decimal point separately
local clone = cloneChars:WaitForChild("."):Clone()
clone.Parent = mainFrame
end
end
end
-- Initial setup
updateZoomGui()
-- Connect the function to update the GUI when the zoom value changes
zoomValue.Changed:Connect(updateZoomGui)
it’s a pretty good script but when the player joins and their Zoom is 32, the gui shows 230. (when you rearrange them you get 32.0). And when you get 33 Zoom is shows 330. (which are the digits for 33.0)
you can do just about anything you want I just want it to show the players zoom -32. It doesn’t need to be math.floor I just thought that would look the best. if this doesn’t work out to well im just going to use a textlabel
Also you could try putting the digits back into order but I have no idea how you would.
Thanks (sorry about the wall of text)