I have a Label that has a function that when it stops being dragged the function runs like so:
script.Parent.DragStopped:connect(function(X, Y) print(("dragging stopped at (%i, %i)"):format(X, Y)," myPos: ",script.Parent.Position) local entireFrame = game.Players.LocalPlayer.PlayerGui.ScriptPart.entireFrame print("test") local data = entireFrame.Script.GetPreviousPos:Invoke(script.Parent.Value.Value,script.Parent.Name) print("test2") -- [================] <-screen width -- [======== ] <- /2 -- [==== ] <- /2/2 -- [== ] <- /2/2/2 -- [= ] <- /2/2/2/2 local partialX = (((entireFrame.AbsoluteSize.X/2)/2)/2)/2 print("frame: ",entireFrame.AbsoluteSize.X/2/2," math:",(entireFrame.AbsoluteSize.X/2/2) + partialX," less than X: ",(entireFrame.AbsoluteSize.X/2/2) + partialX >= X," X: ",X) if ((entireFrame.AbsoluteSize.X/2)/2) + partialX >= X then script.Parent:TweenPosition(UDim2.new(data[1]-1,0,data[2],0)) elseif ((entireFrame.AbsoluteSize.X/2)/2) + partialX <= X then entireFrame.Script.addToScriptEditor:Invoke(script.Parent.Value.Value,script.Parent.Text) script.Parent.Position = UDim2.new(data[1]-1,0,data[2],0) else print("idk what to tell you dude") end end)
it prints "dragging etc..." and "test", i also have more print statements to see if GetPreviousPos gets invoked but it doesn't print either. This all works perfectly fine in Play Mode but not when starting the server in Studio and in online mode. Any suggestions?
Changed the script from a Script to a Localscript, that fixed the problem. :D