En la Out Put me aparece que tengo un error en la linea 5 pero no se que es, aclaro que no se nada de script este script lo saque de Youtube,
function ot(hit)
if hit.Parent ~= nil then
local player = game.Players:playerFromCharacter(hit.Parent)
if player ~= nil then
if player.leaderstats.Stage.Value == script.Parent.Name - 1 then
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
if h.Health ~= 0 then
player.leaderstats.Stage.Value = script.Parent.Name
end end end end end end
script.Parent.Touched:connect(ot)
la lina que me dice que tengo el error es esta
if player.leaderstats.Stage.Value == script.Parent.Name - 1 then
script.Parent.Name will always be a string. You can’t subtract from a string; you have to convert it to a number. You can just do tonumber(script.Parent.Name) - 1 here.
(Attempted translation: script.Parent.Name siempre va a ser un string. No puedes restar algo a un string. Necesita ser un numero. Puedes usar tonumber(script.Parent.Name) - 1 allí.)
function ot(hit)
if hit.Parent ~= nil then
local player = game.Players:playerFromCharacter(hit.Parent)
if player ~= nil then
if player.leaderstats.Stage.Value == tonumber(script.Parent.Name) - 1 then
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
if h.Health ~= 0 then
player.leaderstats.Stage.Value = script.Parent.Name
end end end end end end
script.Parent.Touched:connect(ot)
Give him the solution, i just gave you the script that you needed / Dale la solucion a el, solo te di el codigo que necesitas.