Ok so I am still new to scripting so this might be a very simple mistake but I am making a script that makes it so wherever I place a part on the map they will move to a specific location.
clickdet.MouseClick:Connect(function() if Xvalue<finalx then while Xvalue~=finalx do Xvalue=Xvalue+.5 wait(.1) end elseif Xvalue>finalx then while Xvalue~=finalx do Xvalue=Xvalue-.5 wait(.1) end end end)
this is the script to change the x value of the part. I have one for the Y value but they are pretty much identical and once I figure out how to fix this one I can just mirror it to the y value script. Pretty much how it works is I have 2 number values in the part. One for the x value and one for the y value. When the part is placed somewhere on the map I change the x values and y values to match up with the current position of the part. Then I have a separate part and once clicked it is supposed to fire the script to make this part work. It is supposed to check if if it greater than or less than a variable I made called finalx which is the final x position of the part. and then I have a third script that it constantly setting the x value of the part to the x value number value in the part. When I run the script I get no errors but for some reason the xvalue in the part doesnt change at all. I know the click detector works. I think I explained pretty much everything but if you have any questions just ask down below. I would really appreciate the help.