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
Could you use code block? Then I might be able to answer your question.
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