Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a player gets Rep when they kill someone?

Asked by 4 years ago
Edited 4 years ago

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)



0
Are you trying to do it with letters like for ex: Demon or rep as numbers like Rep: 20 Gingerely 245 — 4y
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. BlackOrange3343 2676 — 4y

Answer this question