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

Another problem with my RP stove. Can you please help me?

Hello, I recently posted a question about my roleplay stove. I ran into another problem.

----------------------------------
----------------------------------
----------------------------------
StoveTop1OC = script.Parent.Parent.StoveTop1.Value
StoveTop2OC = script.Parent.Parent.StoveTop2.Value
StoveTop3OC = script.Parent.Parent.StoveTop3.Value
StoveTop4OC = script.Parent.Parent.StoveTop4.Value

Pan1 = script.Parent.Parent.StoveTop1.Pan
Pan2 = script.Parent.Parent.StoveTop2.Pan
Pan3 = script.Parent.Parent.StoveTop3.Pan
Pan4 = script.Parent.Parent.StoveTop4.Pan
----------------------------------
----------------------------------
----------------------------------
isOn = false
----------------------------------
---------- Remove Below ----------
----------------------------------

function on()
	isOn = true
	print("Pan is on!")
end

function off()
	isOn = false
	print("Pan is off!")
end

---------------------------------- 
---------- Remove Above ----------
----------------------------------
function OccupiedNote()
	game.ServerStorage.OccuiedNote.clone()
end

function onTouched(hit)
	if hit.Name == "Pan" then
		function check()
			print("Checking...")
			switch()
		end
		----------------------------------
		----------------------------------
		----------------------------------
		function switch(Checking1)
			function Checking1()
				if StoveTop1OC.Value == "Unoccupied" then place1() else StoveTop1OC.Value.new = "Occupied", Checking2() end
			end
			function Checking2()
				if StoveTop2OC.Value == "Unoccupied" then place2() else StoveTop2OC.Value.new = "Occupied", Checking3() end
			end
			function Checking3()
				if StoveTop3OC.Value == "Unoccupied" then place3() else StoveTop3OC.Value.new = "Occupied", Checking4() end
			end
			function Checking4()
				if StoveTop4OC.Value == "Unoccupied" then place4() else StoveTop4OC.Value.new = "Occupied", OccupiedNote() end
			end
			----------------------------------
			----------------------------------
			----------------------------------
			function place1()
				hit:remove()
				script.Parent.Parent.StoveTop1.Pan.Transparency = 0
			end
			function place2()
				hit:remove()
				script.Parent.Parent.StoveTop2.Pan.Transparency = 0
			end
			function place3()
				hit:remove()
				script.Parent.Parent.StoveTop3.Pan.Transparency = 0
			end
			function place4()
				hit:remove()
				script.Parent.Parent.StoveTop4.Pan.Transparency = 0
			end
		end
	end
end

I have an invisible non-cancolide brick on the stove for when a tool named "Pan" touches it the pans on the stove will become visible depending if there is a slot free. There are 4 spots free for each tool (Named pan) to go. Once it touches the invisible brick the tool get's removed and a pan on the stove becomes visible. I kindof got lost during the scripting. Can you please help me?

1 comment

0

I don't understand what the problem actually is. However, improvements include: Line 47 doesn't need an argument; 35 might have a typo on it ("occuied" instead of "occupied"); you don't use your "on"/"off" functions (maybe you just didn't show us that part)

1 answer

Line 35, you did .Clone instead of :Clone. Also I don't know if Occupied is spelled wrong, but that could be another issue.

----------------------------------
----------------------------------
----------------------------------
StoveTop1OC = script.Parent.Parent.StoveTop1.Value
StoveTop2OC = script.Parent.Parent.StoveTop2.Value
StoveTop3OC = script.Parent.Parent.StoveTop3.Value
StoveTop4OC = script.Parent.Parent.StoveTop4.Value

Pan1 = script.Parent.Parent.StoveTop1.Pan
Pan2 = script.Parent.Parent.StoveTop2.Pan
Pan3 = script.Parent.Parent.StoveTop3.Pan
Pan4 = script.Parent.Parent.StoveTop4.Pan
----------------------------------
----------------------------------
----------------------------------
isOn = false
----------------------------------
---------- Remove Below ----------
----------------------------------

function on()
    isOn = true
    print("Pan is on!")
end

function off()
    isOn = false
    print("Pan is off!")
end

---------------------------------- 
---------- Remove Above ----------
----------------------------------
function OccupiedNote()
    game.ServerStorage.OccuiedNote:clone()
end

function onTouched(hit)
    if hit.Name == "Pan" then
        function check()
            print("Checking...")
            switch()
        end
        ----------------------------------
        ----------------------------------
        ----------------------------------
        function switch(Checking1)
            function Checking1()
                if StoveTop1OC.Value == "Unoccupied" then place1() else StoveTop1OC.Value.new = "Occupied", Checking2() end
            end
            function Checking2()
                if StoveTop2OC.Value == "Unoccupied" then place2() else StoveTop2OC.Value.new = "Occupied", Checking3() end
            end
            function Checking3()
                if StoveTop3OC.Value == "Unoccupied" then place3() else StoveTop3OC.Value.new = "Occupied", Checking4() end
            end
            function Checking4()
                if StoveTop4OC.Value == "Unoccupied" then place4() else StoveTop4OC.Value.new = "Occupied", OccupiedNote() end
            end
            ----------------------------------
            ----------------------------------
            ----------------------------------
            function place1()
                hit:remove()
                script.Parent.Parent.StoveTop1.Pan.Transparency = 0
            end
            function place2()
                hit:remove()
                script.Parent.Parent.StoveTop2.Pan.Transparency = 0
            end
            function place3()
                hit:remove()
                script.Parent.Parent.StoveTop3.Pan.Transparency = 0
            end
            function place4()
                hit:remove()
                script.Parent.Parent.StoveTop4.Pan.Transparency = 0
            end
        end
    end
end

1 comment

0

No. That didn't fix it. But thanks for pointing the ":clone()" Part out. Also, Occupied shouldn't be an issue. It's stating a name of a item that I named "Occupied" or it's the name of a function.

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