Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I script?

I need someone to give a detailed guide that I can refer to for scripting. From the tutorial I think this works, but im not sure.

local playerHealth = parent.parent.Humanoid.health -- Creates value that changes on the humanoid's health
function checkDeath(checkDeath) -- Checks if dead.
	if playerHealth = 0
		local playerHealth = 1 -- Quickly! Save him!
		local deathQuestion = "It appears you have died. Try again?"
		local reEssenceTextValue = "(reEssenceValue) Re-essences)"
		function checkReEssenceValue(checkReEssenceValue) - Checks if re-essence value is 0, then kills the player. If it's 1 or 2 or 12391230123 or anything over 0, SAVE DA PLAYYAAA
			if reEssenceValue = 0
				local playerHealth = 0
			end
		checkReEssenceValue
		function clickedYes(clickedYes)
			local playerMaxHealth = parent.parent.Humanoid.maxHealth
			local playerHealth = (playerMaxHealth)
		end
		function clickedNo(clickedNo)
			local playerHealth = 0
		end
		loop
			if clickedNoButton = 1
				clickedNo
			if clickedYesButton = 1
				clickedYes
		end
	end

1 answer

local playerHealth = parent.parent.Humanoid.health -- "parent" is not defined
function checkDeath(checkDeath) -- unused argument
    if playerHealth = 0 -- missing "then"
        local playerHealth = 1 -- variable declared in local scope and will not affect the original
        local deathQuestion = "It appears you have died. Try again?" -- unused variable
        local reEssenceTextValue = "(reEssenceValue) Re-essences)" -- unused variable
        function checkReEssenceValue(checkReEssenceValue) -- unused argument
            if reEssenceValue = 0 -- missing "then"
                local playerHealth = 0 -- variable declared locally, this will do nothing
            end
        checkReEssenceValue -- ()
        function clickedYes(clickedYes) -- unused argmuent
            local playerMaxHealth = parent.parent.Humanoid.maxHealth -- parent is undefined
            local playerHealth = (playerMaxHealth) -- these variables are in local scope
        end
        function clickedNo(clickedNo) -- unused argument
            local playerHealth = 0 -- local scope
        end
        loop -- this doesn't mean anything
            if clickedNoButton = 1 -- then
                clickedNo -- ()
            if clickedYesButton = 1 -- then
                clickedYes -- ()
        end
    end
-- end

If you have no understanding of Lua syntax or programming logic then you could at least start here

This discussion is preserved as it was. New answers, comments, and votes are closed.