In there game there's a leaderstats and in intvalue called Level. This script is supposed to bring up the level by one on every ko the player gets. This script is located inside the tool (sword). There are two problems: I cannot capture the player to add it to the board so I used :getplayerfromcharacter and that didn't work. The second problem is that people are able to get more than one level up by hitting the body several times after death which is a problem.

--Define your player
local plr = game.Players.LocalPlayer

script.Parent.Handle.Touched:connect(function(hit)
    --Checks to make sure it's a player
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
    if plr then
        --Create the tag, place it in their Humanoid
        local tag = Instance.new('ObjectValue',hit.Parent.Humanoid)
        tag.Name = 'creator'
        -- value =  player instance
        tag.Value = plr
wait(.5)
local holder = script.Parent.Parent:GetPlayerFromCharacter()
local level = holder.leaderstats.Level
if tag.Parent.Health == 0 then
	level.Value = level.Value + 1
        --Tag Expire
        wait(.5)
        tag:Destroy()
		end
	end
end)

If it's possible that you explain/fix this that would be great thanks.

2 comments

0

you're missing an end at line 12-13 or 21-22 idk where your scope ends

0

Use the humanoid 'Died' event?