'attempt to call a Instance value'?

Not sure how to fix this. Any help would be nice!

function createsave1(player)
	local playersData
	local success, errormessage = pcall(function()
		playersData = game:GetService("DataStoreService"):GetDataStore("DSCharSave1"):GetAsync(player.UserId.."_CharDataSave1")
	end)
	
	if success then
		warn("Got players data successfully!")
		if playersData then
			CharacterTable = playersData
			warn("Applied stats table!")
		end
	end
	
	if errormessage then
		warn("ERROR FINDING/CREATING SAVE 1: " .. errormessage)
	end
end

CreateSave1.OnServerEvent:Connect(function(player)
	CreateSave1(player) --  <- this is the line in the error that comes up
	warn("Successfully Created Save 1!")
end)

error is: ServerScriptService.SavesManager:Line highlighted in code: attempt to call a instance value

1 Like

Lua needs the variable and functions names to be 1:1.
Try to change it to createsave1(player) just like you assigned it in the function.

3 Likes

You might wanna change the remote events name to something else.

That is happening because you have a RemoteEvent defined as “CreateSave1” and a function defined as “createsave1”. See the difference? You then call a RemoteEvent instead of a function. It is better to name things differently and not rely on casing.

1 Like

Yeah this is a pretty big security issue.
They should rate limit the event on the server so people don’t just spam the remote event and fill the DataStore request queue.

legend lol, didnt notice that thanks

1 Like

Not really to limit the attempts but they can however add a small delay such as debounce

This would make it so any other player can’t save while it’s waiting for the debounce.
If they make a debounce on the clinet exploiters can just make a loop and fire the event many times a second and make it so no data saves.

Not unless they add a table for players with debounce

1 Like

That technically is rate limiting but makes sense if you call it a debounce.