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

How do I make it so that it puts health into the npc? [closed]

Asked by 3 years ago

I made a script but when i try to add the health into the npc this is my script

local v1 = nil;
selected = "";
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local l__Team__3 = l__LocalPlayer__2.Team;
while true do
    wait();
    v1 = l__LocalPlayer__2.Team;
    if v1 ~= nil then
        break;
    end;
end;
local u1 = v1;
function lock()
    u1 = l__LocalPlayer__2.Team;
    if u1.Name == "Host" then
        script.Parent.Visible = true;
        return;
    end;
    script.Parent.Visible = false;
end;
l__LocalPlayer__2.Changed:Connect(function()
    lock();
end);
script.Parent.Changed:Connect(function()
    lock();
end);
lock();
script.Parent.Red.MouseButton1Down:Connect(function()
    script.Parent.Display.Text = workspace.NPCS.RedNPC.Humanoid.Health;
    selected = "RedNPC";
end);
script.Parent.Yellow.MouseButton1Down:Connect(function()
    script.Parent.Display.Text = workspace.NPCS.YellowNPC.Humanoid.Health;
    selected = "YellowNPC";
end);
script.Parent.Green.MouseButton1Down:Connect(function()
    script.Parent.Display.Text = workspace.NPCS.GreenNPC.Humanoid.Health;
    selected = "GreenNPC";
end);
script.Parent.Blue.MouseButton1Down:Connect(function()
    script.Parent.Display.Text = workspace.NPCS.BlueNPC.Humanoid.Health;
    selected = "BlueNPC";
end);
script.Parent.Add.MouseButton1Down:Connect(function()
    script.Parent.Display.Text = script.Parent.Display.Text + 1000;
end);
script.Parent.Subtract.MouseButton1Down:Connect(function()
    script.Parent.Display.Text = script.Parent.Display.Text - 1000;
end);
local l__UpdateHealth__2 = game.ReplicatedStorage.UpdateHealth;
script.Parent.RedEnter.MouseButton1Down:Connect(function()
    l__UpdateHealth__2:FireServer(workspace.NPCS.RedNPC.Humanoid, script.Parent.Display.Text);
end);
script.Parent.YellowEnter.MouseButton1Down:Connect(function()
    l__UpdateHealth__2:FireServer(workspace.NPCS.YellowNPC.Humanoid, script.Parent.Display.Text);
end);
script.Parent.GreenEnter.MouseButton1Down:Connect(function()
    l__UpdateHealth__2:FireServer(workspace.NPCS.GreenNPC.Humanoid, script.Parent.Display.Text);
end);
script.Parent.BlueEnter.MouseButton1Down:Connect(function()
    l__UpdateHealth__2:FireServer(workspace.NPCS.BlueNPC.Humanoid, script.Parent.Display.Text);
end);

0
Does it throw an error? If it does what is it? dinko13579 35 — 3y

Closed as Non-Descriptive by virushunter9 and JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?