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

How do I get a Character Removing method to work?

Asked by 10 years ago

Does character removing method need to be in a local script? cause it apparently doesn't seem to be working in a script. Can someone help me find out why it's not working?? When the value of the person dies it would only print the name that died and nothing else.

script.Parent.Changed:connect(function() if game.Players:FindFirstChild(script.Parent.Value) then local kk = game.Workspace:FindFirstChild(script.Parent.Value) local jk = Instance.new("StringValue",kk) jk.Name = "FightingForBlue" local k = game.Players:FindFirstChild(script.Parent.Value) k.CharacterRemoving:connect(function(character) print(k.Name .. " has died.") wait(0.5) if k:FindFirstChild("BlueFighter") then blueo() elseif k:FindFirstChild("King") then kingo() end end) end end)

function blueo() local err = script.Parent.Parent.Parent.Er if game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") ~= nil then print("Tie") err.Value = 8 elseif game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") then print("Green won that round!") err.Value = 12 game.Players:FindFirstChild(script.Parent.Value).TeamColor = BrickColor.new("Mid gray") game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("Head"):Remove() game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("Head"):Remove() end end

function kingo() print("Started Kingo") local err = script.Parent.Parent.Parent.Er if game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") ~= nil then print("No one wins the tournament.") err.Value = 60 elseif game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") then print("Green Won!") err.Value = 20 end end

0
Please put the code in a code block, makes it easier to read. Dummiez 360 — 10y
0
I don't know how to. billybobtijoseph 1 — 10y

4 answers

Log in to vote
1
Answered by
Maxomega3 106
10 years ago

Try Chararater.Humanoid.Died instead.

Ad
Log in to vote
0
Answered by 10 years ago

Could you use code block? Then I might be able to answer your question.

0
How? billybobtijoseph 1 — 10y
0
Press edit and then put the script in code block. To get code block press the code block button. coldice231 45 — 10y
Log in to vote
0
Answered by
dreamy67 135
10 years ago

Click on the lua button then paste the code into it

Log in to vote
0
Answered by 10 years ago

Does character removing method need to be in a local script? cause it apparently doesn't seem to be working in a script. Can someone help me find out why it's not working?? When the value of the person dies it would only print the name that died and nothing else.

script.Parent.Changed:connect(function()
if game.Players:FindFirstChild(script.Parent.Value) then
local kk = game.Workspace:FindFirstChild(script.Parent.Value)
local jk = Instance.new("StringValue",kk)
jk.Name = "FightingForBlue"
local k = game.Players:FindFirstChild(script.Parent.Value)
k.CharacterRemoving:connect(function(character)
print(k.Name .. " has died.")
wait(0.5)
if k:FindFirstChild("BlueFighter") then
blueo()
elseif k:FindFirstChild("King") then
kingo()
end
end)
end
end)

function blueo()
local err = script.Parent.Parent.Parent.Er
if game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") ~= nil then
print("Tie")
err.Value = 8
elseif game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") then
print("Green won that round!")
err.Value = 12
game.Players:FindFirstChild(script.Parent.Value).TeamColor = BrickColor.new("Mid gray")
game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("Head"):Remove()
game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("Head"):Remove()
end
end

function kingo()
print("Started Kingo")
local err = script.Parent.Parent.Parent.Er
if game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") ~= nil then
print("No one wins the tournament.")
err.Value = 60
elseif game.Workspace:FindFirstChild(script.Parent.Value):FindFirstChild("FightingForBlue") ~= nil and game.Workspace:FindFirstChild(script.Parent.Parent.Parent.Green.Fighting.Value):FindFirstChild("FightingForGreen") then
print("Green Won!")
err.Value = 20
end
end

Answer this question