#help with tag humanoid

71 messages · Page 1 of 1 (latest)

remote dagger
#

so what shows in output

#

so what is supposed to happen

#

so when u equip it supposed to give cash

#

oh k

#

yes i can

#

so here is the fix for the Died Event```lua
local Humanoid = script.Parent.Humanoid

function died()
print("died called")
local tag = Humanoid:FindFirstChild("creator")
if tag then
print("found creator tag")
local player = tag.Value
if player then
print("found player")
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
print("found leaderstats")
leaderstats.Cash.Value = leaderstats.Cash.Value + math.random(60,100)
print("added cash to leaderstats")
wait(0.1)
else
print("no leaderstats found")
end
else
print("no player found")
end
else
print("no creator tag found")
end
script:Destroy()
end

Humanoid.Died:Connect(died)

civic sealBOT
#

studio** You are now Level 6! **studio

remote dagger
#

so now time to see if i can fix the main one

#

so rn it might take a little bit but ill see what i can do

#

im almost done i just need to relook it over and see if need adjustments

#

ok getting closer to show the print for the Tag

#

ok getting closer almost got it to print the Tag

#

maybe this but dont know```lua
local tool = script.Parent
local handle = tool.Handle
local anims = tool.Anims
local sounds = handle.Sounds
local idle = tool.Idle
local trail = handle.Trail

local equipSound = sounds.Equip
local swingSounds = sounds.Swing:GetChildren()
local hitSounds = sounds.Hit:GetChildren()

local isDeactivated = true
local canHit = false

local function swing()
if not isDeactivated then
return
end
isDeactivated = false

local selectedAnim = anims:GetChildren()[math.random(1, #anims)]
local selectedSwingSound = swingSounds[math.random(1, #swingSounds)]

local hum = tool.Parent.Humanoid
local selectedTrack = hum:LoadAnimation(selectedAnim)
selectedTrack:Play()

trail.Enabled = true
selectedSwingSound:Play()

wait(0.5)

canHit = true
trail.Enabled = false

wait(0.5)

canHit = false
isDeactivated = true

end

tool.Equipped:Connect(function()
local hum = tool.Parent.Humanoid
local idleTrack = hum:LoadAnimation(idle)
idleTrack:Play()
equipSound:Play()

tool.Activated:Connect(swing)

handle.Touched:Connect(function(hit) -- DMG
    if canHit then
        canHit = false

        local targetHum = hit.Parent:FindFirstChild("Humanoid")
        if targetHum then
            targetHum:TakeDamage(50)
        end

        local selectedHitSound = hitSounds[math.random(1, #hitSounds)]
        selectedHitSound:Play()
    end
end)

tool.Unequipped:Connect(function()
    idleTrack:Stop()
end)

end)

remote dagger
#

nice but forgot that u cant do that in the math.random

#

ye

copper lark
#

when you Run, "creator" exists in Humaniod?

#

You can see it

#

screenshot objects in character

#

please

#

Can you open humanoid?

#

i wanna know, what is "creator"?

#

You can instance a value with player name

#

one sec

#

uh

#

it is work but you can safe the nickname of player

#
function tagCharacter(humanoid, player)
    local creator_tag = Instance.new("StringValue")
    creator_tag.Value = player.Name
    creator_tag.Name = "creator"
    creator_tag.Parent = humanoid.Parent
end
#

You can safe just nickname

#

function untagCharacter(humanoid)
if humanoid ~= nil then
local tag = humanoid.Parent:FindFirstChild("creator")
if tag ~= nil then
tag.Parent:Destroy()
end
end
end

#

You can keep the player's name

#

my bad

#

just delete dot

#

nope

#

im just dont update

copper lark
#
local Humanoid = script.Parent.Humanoid

function died()
    print("died called")
    local tag = Humanoid.Parent:FindFirstChild("creator")
    if tag then
        print("found creator tag")
        local player = tag.Value
        if player then
            print("found player")
            local leaderstats = player:FindFirstChild("leaderstats")
            if leaderstats then
                print("found leaderstats")
                leaderstats.Cash.Value = leaderstats.Cash.Value + math.random(60,100)
                print("added cash to leaderstats")
                wait(0.1)
            else
                print("no leaderstats found")
            end
        else
            print("no player found")
        end
    else
        print("no creator tag found")
    end
    script:Destroy()
end

Humanoid.Died:Connect(died)
#

And i wanna know, where you giving a tag?

#

you must call function to give tag, no creator tag found because tag not exists

#

just call function?

#

just call function to give tag'

copper lark
#

where you calling function?

#

You not calling

#

You just init this function, but not call

#

tagCharacter(...)

#

It is initialization, on this line you making this function

#

You just make but not used

#

how tag giving?

#

when/how

#

Here i see only tool script

#

I mean

#

Where is tag exist?

#

In character

#

But when tag must be giving?

#

local targetHum = hit.Parent:FindFirstChild("Humanoid")
local char = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if targetHum then
targetHum:TakeDamage(50)

            tagCharacter(targetHum, plr) 
        end
#

replace

#

local targetHum = hit.Parent:FindFirstChild("Humanoid")
local char = targetHum.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if targetHum then
targetHum:TakeDamage(50)

            tagCharacter(targetHum, plr) 
        end
civic sealBOT
#

studio** You are now Level 6! **studio

copper lark
#

try this

#

local targetHum = hit.Parent:FindFirstChild("Humanoid")
if targetHum == nil then
print("hum is nil")
end

local char = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if targetHum then
targetHum:TakeDamage(50)

            tagCharacter(targetHum, plr) 
        end
#

can you add it and screenshot of console

#

Can you show 81 line*

#

&

#

?

#

touched is not working

#

So

#

Can you added me to project?

#

Im send in DM