if you die, your leaderstats value will go up by 1. but, if you reach 10 deaths, you’re supposed to get a faster reload time, but the end) says there can’t be a bracket, and if I do remove it, it says line 4 got not “)”
Do I need to place the script in a separate line? my script:
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local DataStore = DataStoreService:GetDataStore("Deaths")
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Deaths = Instance.new("StringValue")
Deaths.Name = "Deaths"
Deaths.Value = DataStore:GetAsync(player.UserId) or 0
Deaths.Parent = leaderstats
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
leaderstats.Deaths.Value = leaderstats.Deaths.Value + 1
if Deaths.Value == 10 then
game.Players.RespawnTime = 4.5
end) -- red line below the bracket
end)
end)
Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, Player.leaderstats.Deaths.Value)
end)
