I want to make it to where when a player kills another player, they get Rep.

--Leaderstats script

local leaderstats = script.Parent.LeaderStats
leaderstats.Parent = game.ServerScriptService

local DataStore = game:GetService("DataStoreService") 
local SlayerStore = DataStore:GetDataStore("SlayerStore")
local DemonStore = DataStore:GetDataStore("DemonStore")

game.Players.PlayerAdded:Connect(function(player) 
	local leaderstats = Instance.new("Folder",player) 
	leaderstats.Name = "leaderstats" 
	
	local Rep = Instance.new("IntValue")
	Rep.parent = leaderstats
	Rep.Value = SlayerStore:GetAsync(player.UserId) or 0
	
	
	
	print("Loaded!")
end)

game.Players.PlayerRemoving:Connect(function(player) 
	SlayerStore:SetAsync(player.UserId, player.leaderstats.Rep.Value)
	print("Saved!")
end)



2 comments

0

Are you trying to do it with letters like for ex: Demon or rep as numbers like Rep: 20

0

What you want to do is where you deal damage to someone; check if it's a player and check if it is dead after you deal the damage.