So i am using datastores2 to get a value and set it as the contents of a button. This works, except when i click Stop (in playtest mode), it breaks roblox studio completely.
Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local DataStore2 = require(ServerScriptService.DataStore2)
function settext()
local pointsStore = DataStore2("points", script.Parent.Parent.Parent.Parent.Parent) -- This is what seems to be the issue, found that out by commenting the 2 lines below this and the error still apears...
script.Parent.Text="Points: " .. pointsStore:Get(100)
pointsStore:Increment(1)
end
script.Parent.MouseButton1Click:Connect(settext)
Images:
StarterGUI Structure: https://gyazo.com/bf78e96d18b06b445e16b8b0a7527403
Error:
EDIT: Seems like the latest Roblox Studio update fixed this :D

2 comments
What is script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent ? You should never have this many .Parent's in a row. You should be using variables to shorten this
@programmerHere I was gonna change it eventually, but changing it to a variable has no impact on the situation. script.Parent.Parent.Parent.Parent.Parent is the same thing as for a localscript "game.Players.LocalPlayer" - i am not using a localscript, because if i was, i could not access datastores/datastores2