game.ReplicatedStorage.Remotes.Remove.OnServerEvent:Connect(function(player) local ds = game:GetService("DataStoreService"):GetDataStore("ToolSave") local key = "id-"..player.userId local tools = ds:GetAsync(key) ds:SetAsync("Key", nil) end)
Heres my script i dont know whats happening but it says ServerScriptService.Rebirtho:3: attempt to index field 'Remove' (a function value)
what does this mean
So if you have a child with the same name as one of the three, you will be accessing the property/event/method instead.
Instance:Remove
is a deprecated roblox function. It isn't completely gone though, you can still use it, though it is encouraged to avoid deprecated items.
Remember that
lua
object:method(...)
Is just syntactic sugar (a nicer way to write something) for this:
lua
object.method(object, ...)
You can index for a function without calling it aswell.
```lua
local random = math.random; --// random
variable contains the math.random function, we indexed for it, we didn't call it
print(random(5, 10)); --> 7
local part = Instance.new("Part"); part.BrickColor = BrickColor.new("Really red"); part.Parent = game:GetService("Workspace");
local part2 = Instance.new("Part");
part2.Parent = part.Parent;
part.Clone(part2).Parent = part.Parent;
--// part2 gets cloned since in object.method(object, ...)
object is part2
```
Basically, Lua thought you were trying to index for the Remove
function.
The solution is to rename it to something like Delete
, but anything that is not "reserved."