im trying to grab the value from one leaderstat and put it into another leaderstat, is that possible?
local ui = script.Parent
local player = game.Players.LocalPlayer
while wait() do
local player = game.Players.LocalPlayer
ui.Text = ""..player:WaitForChild("Equipped"):FindFirstChild("One").Value
end
function leftClick()
player.Equipped.One.Value = player.Equipped.Current.Value
end
ui.MouseButton1Click:Connect(leftClick)

27 comments
you shouldnt be using a while loop like that, use GetPropertyChangedSignal, theres no point in concatenating an empty string, what exactly is player.Equipped.One and player.Equipped.Current and are they used on the server?
Player.Equipped.One is the ability equipped in the one slot and Player.Equipped.Current is the selected ability. Say you wanted to equip the fireball ability, you would press the fireball button and the Player.Equipped.Current which is a string would change to "FireBall" then you would press on the number that you want to equip the ability to i.e 1-5. Then when you press on 1 or 5 or whatever-
number between them, it should get the string value from the Current and set it to the Number that you pressed, in this case "One". the empty string is to just display the ability name
okay i understand the one and current now, but you still shouldn't need the empty string, i also didnt realise this earlier but its good practice to use local function over function, although it looks like this code should work unless the values need to be updated on the server too
I dont understand why it wont work
are the values being updated? you could check in studio playtesting with the explorer, i assume this script is a localscript (it uses LocalPlayer so it has to be), are the values (Equipped.XYZ & Equipped.Current ever accessed on the server? these are the only reasons i could think it isnt working
i dont exactly know what accessed on the server means
like ever called on a server script?
a server script (any Script or ModuleScript (required by a Script and not a LocalScript)) reading the Value of an Equipped Value
no, they arent
it could be that your UserInputService (or whatever you use to detect key presses) implementation isnt working correctly
oh the 1-5 buttons are a ui
the script i put on this post is from the 1 button
oh, well you should try using print to debug your code to see where it stops working
ok ill try that
i put a print in the function before and after the Player.Equipped.One.Value = player.Equipped.Current.Value and neither print came up
then its prboably that theres a gui above the one you want the MouseButton1Click event to be firing, instead its firing the one above, check if theres any guis (invisible or not) above it, it could also be because its a rounded gui and you're accidently clicking the image instead of the actual button
by accidently i mean that the image is above the textbutton, not that you're actually clicking the image but that could be it
https://gyazo.com/b72fb76fc93e321b6714a2250fb06f16 there isnt
i mean in the actual rendering, not the explorer
https://gyazo.com/260d9c6c8a4e4ce1c83074e4d2fe3e3a the white "1" is the button
well it seems like it should be working, i have no idea why it isnt
this is the weirdest thing i have experienced
Oh, i know now, its because a while loop yields infinitely and you havent created a new thread for it, this can be solved with coroutine.wrap/coroutine.new & coroutine.resume or just by using GetPropertyChangedSignal
I was about to say i changed the while loop to player.Equipped.One.Changed:Connect(function(newVal) and that fixed it
alright, thats good to know, but you should use player.Equipped.One.Changed:GetPropertyChangedSignal("Value") instead of .Changed
alright ill do that