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

Other peoples can see humanoid value change in local?

Asked by
TechModel 118
3 years ago
Edited 3 years ago

This is a local script and thought it would only be seen locally with the gui indication parented to the Starter Gui so its on the screen all the time, only appears when i damage other players. Somehow, when players damage someone, I can see their damage and I do not want that. If there were multiple people attacking each other and on my screen i see numbers jumbled up and I don't want this. I want it to appear to the humanoid damage when I damage the player. Pretty sure it has something to do with humanoid track and detect specifically if they are target by a player and giving them only the value damage to that local player, but not sure if that's how it works or I don't know how to fix that. Made it so the label follows the mouse, which i tweaked that, the rest I didn't made it, so don't get mad at me if it is a bad script, because it is. Somesay it has recursion which I guess, but I don't really care about that atm. Just how I can see other peoples doing damage and when Im not involved in it. I want to see numbers or values of the damage to the humanoid specifically me to see it change. Also somehow fix when I take damage, I can see my own number that I don't want, just the targets damage value that I've done.

I know what I've said is a rushed and unclear of my objective/goal so I'll explain briefly.

Objective: I want this script (damage indicator) which is followed by the mouse to only show damage to the humanoid when I am doing damage to it, and I want to not see others damage values, which I see random numbers with no correlation to my actions (including myself when I reset).

If there's an alternative damage indicator that only shows the damage locally when you do damage the humanoid and see it, but not others, and if you are happy to provide me with the details or the links, then I'm happy to research it. Appeciate if you can help, thanks.

wait(3)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local label = script.DamageGui.TextLabel
local gui = script.DamageGui

gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

function updatePos()
    label.Position = UDim2.fromOffset(mouse.X,mouse.Y)
end

mouse.Move:Connect(updatePos)

function Track(Humanoid)
    local Last = Humanoid.Health
    local function HealthChanged(Left)
        if Left < Last then
            -- things go here text --
                if Left < Last then
                    wait(5)
                    for i = 0, 1, -0.01 do
                        label.TextTransparency = i
                        wait(.1)
                    end
                    label.Visible = false
                    return

                else
                wait(3)
                    label.Visible = false
                    end
            end
            Last = Left
        end
    end
    Humanoid.HealthChanged:connect(HealthChanged)
end

local D = game.Workspace:GetDescendants()
for i = 1,#D do
    if D[i]:IsA("Humanoid") then
        Track(D[i])
    end
end
function Added(item)
    if item:IsA("Humanoid") then
        Track(item)
    end
end
game.Workspace.DescendantAdded:connect(Added)

Answer this question