So i was fixing my roulette table then this happened.
I didn’t even touch this script. And i know the error comes from this script because if it succeeded, then a gui would apear… but it just broke.
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if not script.Parent.Parent.Parent.Parent.DontBet.Value then
if script.Parent.Parent.Parent:FindFirstChild(plr.Name) == nil then
local guiOpen = Instance.new("BoolValue")
guiOpen.Name = plr.Name
guiOpen.Value = false
guiOpen.Parent = script.Parent.Parent.Parent
end
if script.Parent:FindFirstChild(plr.Name) ~= nil then
plr.leaderstats.G.Value = plr.leaderstats.G.value + script.Parent:FindFirstChild(plr.Name).Bet.Value
plr.leaderstats.Token.Value = plr.leaderstats.Token.Value + 1
script.Parent:FindFirstChild(plr.Name):Destroy()
end
if not script.Parent.Parent.Parent[plr.Name].Value then
script.Parent.Parent.Parent[plr.Name].Value = true
local gui = game.ServerStorage.BetGui:Clone()
gui.BNumber.Value = tonumber(script.Parent.Name)
gui.BColor.Value = script.Parent.SurfaceGui.Frame.BackgroundColor3
gui.Close.Value = script.Parent.Parent.Parent[plr.Name]
gui.BetFolderParent.Value = script.Parent
gui.Parent = plr.PlayerGui
end
end
end)
This doesn’t use DataStore in ANY way (that i see).
The error on line 16 makes completly no sense. Are you really sure the error is happening in this script? It could be as well something with collaborative editing, if you have collaborative editing on, then check you have commited changes. It’s really weird.
Next run
No need to create check
Broke
Gave your money back (intentional, not an error condition)
But the money saves when you leave, and not when changed…
And changing the money value doesn’t use DataStore.
Hmmm
So it broke 2. if statement.
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if not script.Parent.Parent.Parent.Parent.DontBet.Value then
if script.Parent.Parent.Parent:FindFirstChild(plr.Name) == nil then
local guiOpen = Instance.new("BoolValue")
guiOpen.Name = plr.Name
guiOpen.Value = false
guiOpen.Parent = script.Parent.Parent.Parent
print("Created GuiCheck")
end
if script.Parent:FindFirstChild(plr.Name) ~= nil then
plr.leaderstats.G.Value = plr.leaderstats.G.value + script.Parent:FindFirstChild(plr.Name).Bet.Value
plr.leaderstats.Token.Value = plr.leaderstats.Token.Value + 1
script.Parent:FindFirstChild(plr.Name):Destroy()
print("Gave back your money")
end
if not script.Parent.Parent.Parent[plr.Name].Value then
print("Gui creation started")
script.Parent.Parent.Parent[plr.Name].Value = true
print("Gui open signal")
local gui = game.ServerStorage.BetGui:Clone()
print("Gui cloned")
gui.BNumber.Value = tonumber(script.Parent.Name)
print("Gui edited")
gui.BColor.Value = script.Parent.SurfaceGui.Frame.BackgroundColor3
print("Gui edited")
gui.Close.Value = script.Parent.Parent.Parent[plr.Name]
print("Gui edited")
gui.BetFolderParent.Value = script.Parent
print("Gui edited")
gui.Parent = plr.PlayerGui
print("Gui parented to PlayerGui")
end
end
end)
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if not script.Parent.Parent.Parent.Parent.DontBet.Value then
if script.Parent.Parent.Parent:FindFirstChild(plr.Name) == nil then
local guiOpen = Instance.new("BoolValue")
guiOpen.Name = plr.Name
guiOpen.Value = false
guiOpen.Parent = script.Parent.Parent.Parent
end
if script.Parent:FindFirstChild(plr.Name) ~= nil then
print("Entered statement")
plr.leaderstats.G.Value = plr.leaderstats.G.value + script.Parent:FindFirstChild(plr.Name).Bet.Value
print("Gave back Gold")
plr.leaderstats.Token.Value = plr.leaderstats.Token.Value + 1
print("Gave back Token")
script.Parent:FindFirstChild(plr.Name):Destroy()
print("Deleted check")
print("Gave back your money")
end
if not script.Parent.Parent.Parent[plr.Name].Value then
script.Parent.Parent.Parent[plr.Name].Value = true
local gui = game.ServerStorage.BetGui:Clone()
gui.BNumber.Value = tonumber(script.Parent.Name)
gui.BColor.Value = script.Parent.SurfaceGui.Frame.BackgroundColor3
gui.Close.Value = script.Parent.Parent.Parent[plr.Name]
gui.BetFolderParent.Value = script.Parent
gui.Parent = plr.PlayerGui
end
end
end)
It looks just like some script is saving the money when the Value gets changed. Maybe there is some script that you don’t even know about? I think there might be some script that you don’t know about based on that you are saying that you aren’t saving the money when the Value gets changed, but just when the Player leaves.
You can search for the scripts by using Ctrl + Shift + F and searching for DataStore.
I’m starting to run out of ideas. The last thing that I think might be the issue is the script that is used for saving money itself. If the problem is not there as well then I’m sorry, but I won’t be able to help you.
I don’t think that would solve anything, because the error comes probably from somewhere else. You could try to change your money Value manually and see if the error pops up. If it doesn’t then it’s even more weird than I thought it is.
Yeah don’t spam and like save stuff to a datastore too quickly or whatever or else you’ll have this happen although seems like you’ve already figured that out, but yeah.