So I am working on a map basically however I have a button that is intended to recenter the map into the specified position: {0.5, -1000},{0.5, -550}
which is the position of the Frame when the game starts. Whenever I click the button though, the Frame goes to {0,0},{0,0}
. Why does it not go to the specified position and does it have to do with screen resolution?
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Parent.Map.Position = UDim2.new{0.5, -1000},{0.5, -550} end)
UDim2
values aren’t tables. Wrap the numbers in a pair of brackets. To answer your question if it has to do with resolution: no.local map = script.Parent.Parent.Parent.Map script.Parent.MouseButton1Click:Connect(function() map.Position = UDim2.new(.5, -1000, .5, -550) end)
RBXScriptSignal:Connect()
, as ROBLOX may remove RBXScriptSignal:connect()
in the future.Because you're not supposed to use curly paranthesis - You're supposed to use paranthesis.
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent.Map.Position = UDim2.new(0.5, -1000, 0.5 -550) end)