Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I use values in UDim values?

Asked by 3 years ago

hi, so i'm trying to make clues around a map, and when you click on an object, it adds a clue to a gui, and everytime it does so, it has the same position values as the last one while moving .06 pixels downwards. However, this isn't working for me. Is there anything I'm missing here?

local cluename = script.TextButton
local cluetext = cluename.Value.Value
local clueadd = cluename:Clone()
local clueposition = cluename.Position.Y
local yvalue = game.ReplicatedStorage.yvalue.Value
local nextclueposition = UDim.new(yvalue,.02)
local clueposition=nextclueposition
script.Parent.MouseClick:connect(function(player)
    clueadd.Parent=(player).PlayerGui.ScreenGui.Frame.TruthBulletz.ScrollingFrame
    clueposition=nextclueposition
    yvalue=yvalue+.06
end)

1 answer

Log in to vote
0
Answered by 3 years ago

On line 3, you create a clone of the cluename object. This will only create one object, and not a new one each time. I would put line 3 below line 8, creating a new clone each time you click:

script.Parent.MouseClick:connect(function(player)
    local clueadd = cluename:Clone()
Ad

Answer this question