On/off fireplace

hello, I am trying to achieve an on/off fire, this is my current script which isn’t working.

also, here is the way it is.

Image20210210191046

you see, I want it to turn off 3 of the fires. the size to 0

please help!

local ClickDetector = script.Parent.ClickDetector
local Fire = game.Workspace.fire

ClickDetector.MouseClick:Connect(function()
	            wait(0.1)
				Fire.Size = 0
				wait(0.05)
				Fire.Size = 3.2
end)`

You need to tell the script what ClickDetector is.

local ClickDetector = script.Parent.ClickDetector
1 Like

i did put it, thanks but it still isnt working

Are there any errors that show up?

fire is not a valid member of Workspace “Workspace” - Server - SwitchScript:2

here is the script again.

local ClickDetector = script.Parent.ClickDetector
local Fire = game.Workspace.fire

ClickDetector.MouseClick:Connect(function()
	            wait(0.1)
				Fire.Size = 0
				wait(0.05)
				Fire.Size = 3.2
end)

I’m going to assume fire is a part. If fire is a part then you have to do:

Fire.Size = Vector3.new(0,0,0)

However, that won’t get rid of the fire effect. If you want to do that, you will have to set their Enabled property to false. Sorry if I’m not making sense.

1 Like

Here is a toggable system using a variable

local Fire = game.Workspace:WaitForChild("fire").Fire
local ClickDetector = script.Parent.ClickDetector
local Enabled = false

ClickDetector.MouseClick:Connect(function()
	if Enabled == false then
		Enabled = true
		Fire.Size = 3.2
	else
		Enabled = false
		Fire.Size = 0
	end
end)
4 Likes

still says Fire is not a valid member of Workspace “Workspace”

You need to add a waitforchild because it probably hasn’t loaded in.

Edit: Oh wait I didn’t look at your directory properly, I have updated the script above to work.

1 Like

It’s cause you’re only deactivating 1 of the Fires in that script, but not all of them

You can easily fix this by changing up your code a bit:

local Fire1 = --Location Here
local Fire2 = --Location Here
local Fire3 = --Location Here
local Disabled = false

local ClickDetector = script.Parent.ClickDetector
ClickDetector.MouseClick:Connect(function()
    if Disabled == false then
        Disabled = true
        Fire1.Size = 0
        Fire2.Size = 0
        Fire3.Size = 0
    elseif Disabled == true then
        Disabled = false
        Fire1.Size = 3.2
        Fire2.Size = 3.2
        Fire3.Size = 3.2
    else
        print("W h a t, H O W")
    end
end)

Another thing to keep in mind is, make sure that you name all of your Fires differently so that you don’t keep activating the same one over & over again

1 Like

hmm, still doesnt work. here is the script I use

local Fire1 = game.Workspace:WaitForChild("fire").Fire1--Location Here
local Fire2 = game.Workspace:WaitForChild("fire").Fire2--Location Here
local Fire3 = game.Workspace:WaitForChild("fire").Fire3--Location Here
	local Disabled = false

local ClickDetector = script.Parent.ClickDetector
ClickDetector.MouseClick:Connect(function()
	if Disabled == false then
		Disabled = true
		Fire1.Size = 0
		Fire2.Size = 0
		Fire3.Size = 0
	elseif Disabled == true then
		Disabled = false
		Fire1.Size = 3.2
		Fire2.Size = 3.2
		Fire3.Size = 3.2
	else
		print("W h a t, H O W")
	end
end)

The only issue that I could potentially see is where you’ve parented your Fire Objects at, could you show the Explorer if possible?

1 Like

Screenshot 2021-02-10 at 201139

I meant the Explorer where your Fire Objects are parented from, like where’s the actual base object of that?

1 Like

OSOPSFAPWD- sorry !!!

local Fire1 = script.Parent:WaitForChild("Fire1") --Location Here
local Fire2 = script.Parent:WaitForChild("fire").Fire2--Location Here
local Fire3 = script.Parent:WaitForChild("fire2").Fire3--Location Here
local Disabled = false

local ClickDetector = script.Parent.ClickDetector
ClickDetector.MouseClick:Connect(function()
	if Disabled == false then
		Disabled = true
		Fire1.Size = 0
		Fire2.Size = 0
		Fire3.Size = 0
	elseif Disabled == true then
		Disabled = false
		Fire1.Size = 3.2
		Fire2.Size = 3.2
		Fire3.Size = 3.2
	else
		print("W h a t, H O W")
	end
end)

Change this Part’s Name:
image
To fire2

so, like part is Fire1, fire is Fire1. something like this?

If you wanna put it like that, yes as long as the Variables are Parented to the correct spots

Isn’t the script parented to ClickDetector.Parent ???