First off, make sure the fire's parent is the part itself... Otherwise, the fire will just be on the coordinates 0, 0, 0 since you just put it in workspace. Also, you don't need to keep reparenting the fire over and over for it to show up. Below I'll re-paste your code with the fire done correctly.
local clickDetector = script.Parent.ClickDetector
local part = script.Parent
local clicked = false; -- Boolean that will toggle between which angle it should be.
local old_orientation = part.Orientation; -- The part's original orientation.
local fire = script.Parent:WaitForChild("Fire") -- Variable for the fire inside of the part. It's named 'Fire'.
local function MouseClick(player)
if clicked then -- Checks if clicked is true. Which means it's been clicked. So it will need to go back to it's original orientation.
fire.Enabled = false; -- Changes the enabled property of fire to false.
part.Orientation = old_orientation; -- Sets the orientation back to the original orientation.
else -- If clicked is anything but true.
fire.Enabled = true; -- Changes the enabled property of fire to true.
part.Orientation = Vector3.new(0, 90, 0); -- Sets orientation to this Vector value.
end
clicked = not clicked; -- Makes clicked opposite of what it is. If it's false, it becomes true and if it's true, it becomes false.
end
clickDetector.MouseClick:Connect(MouseClick)
~ KingLoneCat |