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

Why is my kill counter not applying the kills?

Asked by 5 years ago

I made a kill counter but it isn't doing anything when you kill someone. Perhaps it is something wrong with the script? Addkill is a localscript

local addkill = game.ReplicatedStorage.AddKill

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Character:WaitForChild("Humanoid").Died:Connect(function()
            local oof = Character.Humanoid:FindFirstChild("creator")
            if oof ~= nil then
                if oof.Value ~=nil then
                addkill:Clone().Parent = game.StarterPack
            end
        end
    end)
end)
end)

or is it something wrong with the localscript

wait(1)
local plr = game.Players.LocalPlayer.StarterPack.Kills
if script.Parent == game.StarterPack then
    plr.Value = plr.Value + 1
    print("kill")
    wait(0.1)
    script:Destroy()
end

Kills is a numbervalue

0
StarterPack is neither a child nor a descendant of player objects theking48989987 2147 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If FilteringEnabled is enabled, increasing a value with a local script will not be saved to the server. To save it to the server you would need to use RemoteFunctions or RemoteEvents.

Information about Remote Events and Remote Functions

0
you can create hyperlinks with the link tool :p theking48989987 2147 — 5y
0
FilteringEnabled is always enabled on games. xPolarium 1388 — 5y
0
You can disable it justintubba123 6 — 5y
Ad

Answer this question