of     1   

PhantomSquidington
#224385856Tuesday, August 29, 2017 11:15 AM GMT

So basically, I have a part that I wish for the player to click and then rotates the part through its Orientation value, then when they click it again turn it back into its original angled position (haven't put that in the script yet though). This doesn't work for some reason so I decided to check the forums for the help, hope someone can bring some leads as to the problem. Many thanks in advance! Here's the script (I'm sorry if I'm dumb, I tried CFrame too but that didn't work). local clickDetector = script.Parent.ClickDetector local part = script.Parent local function MouseClick(player) part.Orientation(0, 90, -40) end clickDetector.MouseClick:connect(onMouseClick) - VIShark15
LeafDoode
#224385924Tuesday, August 29, 2017 11:19 AM GMT

use Part.Orientation = Vector3.new()
PhantomSquidington
#224386042Tuesday, August 29, 2017 11:26 AM GMT

omg it was Vector3 ;-;, thanks a lot buddy, you're amazing! :) - VIShark15
KingLoneCat
#224386073Tuesday, August 29, 2017 11:28 AM GMT

The problem with your script is that you used the wrong name when connecting the event to the function and you also forgot to set the property correctly. Orientation is a Vector3 and you forgot to make the Orientation equal to a Vector3 value.... Also, don't use deprecated methods like :connect(). I'll show you below the fixes to your script and how you can make it it's original orientation with the second click: 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 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. part.Orientation = old_orientation; -- Sets the orientation back to the original orientation. else -- If clicked is anything but true. part.Orientation = Vector3.new(0, 90, -40); -- 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
PhantomSquidington
#224386949Tuesday, August 29, 2017 12:10 PM GMT

Works like a charm, however I'm having a bit of trouble activating a fire (which is within a part called Fire) when the player clicks on it, and disables the fire when the player clicks on it again (and so on and so forth). What am I doing wrong? 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 = game.Workspace.Fire.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. part.Orientation = old_orientation; -- Sets the orientation back to the original orientation. fire.Enabled = false fire.Parent = workspace else -- If clicked is anything but true. part.Orientation = Vector3.new(0, 90, -40); -- Sets orientation to this Vector value. fire.Enabled = true fire.Parent = workspace 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) - VIShark15
KingLoneCat
#224400171Tuesday, August 29, 2017 7:48 PM GMT

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

    of     1