t = {}
script.Parent.Parent.Activated:Connect(function(g)
local t = game.Players:FindFirstChild(g.Name)
t.leaderstats.Thirst.Value += 4
end)
i searched on the first page of google and i couldnt solve it. some solutions led me to another error "argument 1 missing or nil"
t = {}
script.Parent.Parent.Activated:Connect(function(g)
local t = game.Players:FindFirstChild(g)
t.leaderstats.Thirst.Value += 4
end)
Im trying to make a water bottle and when it's activated it increases the thirst by 4 on the leaderboard
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("PointsSaveSystem")
local db = DataStore:GetDataStore("ThirstSaveSystem")
local df= DataStore:GetDataStore("Food")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Points = Instance.new("IntValue",leader)
Points.Name = "Bucks"
Points.Value = ds:GetAsync(player.UserId) or 30
ds:SetAsync(player.UserId, Points.Value)
-------------------------------------------------------
local Thirst = Instance.new("IntValue",leader)
Thirst.Name = "Thirst"
Thirst.Value = db:GetAsync(player.UserId) or 7
db:SetAsync(player.UserId, Thirst.Value)
---------------------------------------------
local Food = Instance.new("IntValue",leader)
Food.Name = "Food"
Food.Value = df:GetAsync(player.UserId) or 10
df:SetAsync(player.UserId, Food.Value)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Points.Value)
db:SetAsync(player.UserId, player.leaderstats.Points.Value)
df:SetAsync(player.UserId, player.leaderstats.Points.Value)
end)
(code of the datastores and leaderboard)

1 comment
do you know which line on which script the game tells you that erorred?