Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

[ANSWERED]How do I make this script target other bricks within the model?

Asked by 9 years ago

I have a clickable brick with a script inside that executes this action when clicked. However, I can't make the water appear or make it go back to it's original position.

function onClicked(playerWhoClicked)
    script.Parent.Position = Vector3.new(92, 12.401, 87.5) --91.7, 12.401, 87.2 is original
    script.Parent.Rotation = Vector3.new(0, -0, 0) --0, 0, 0 is orignal
    script.Water.Transparency = 0.5
    wait(3)
    script.Parent.Position = Vector3.new(91.7, 12.401, 87.2)
    script.Parent.Rotation = Vector3.new(0, 0, 0)
    script.Water.Transparency = 1
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

EDIT: This script is inside a brick inside a model. The "Water" in the script is a part inside the model as well

0
NOTE: The "Water" is what the brick is called that I want to appear, and the lines after "wait" won't work XxDarkMiragexX 45 — 9y
0
You can edit your question, you know. Diitto 230 — 9y
0
Debounce is key. Diitto 230 — 9y
0
I feel like a denounce wouldn't be necessary. I'm using a brick that's clicked on instead of touched by the player. XxDarkMiragexX 45 — 9y
View all comments (2 more)
1
You can still spam click. BSIncorporated 640 — 9y
0
So it would "script.Parent.Parent" since the script is inside a brick in the model, correct? No, then you would be moving the whole model itself. EzraNehemiah_TF2 3552 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Your script looks fine, minus line 4 and 8. I don't know if you have a part called Water inside of your script, if it's not inside of your script then it is wrong. Also, you are using Position so if any part will be in the area this part called Water will be, when you move it, the part will go on top of another part. You said nothing about it moving somewhere and ending up too high, so i'll assume that's not happening.

So, I don't know your layout but I think you Hierarchy may be incorrect. If script is inside of a model and so is water, you want to do script.Parent.Water.Transparency = 0.5 Other than what I said are possibilities, I believe your script is fine.

0
The script is inside a brick, that's in a model, to hopefully get rid of any confusion. I'm actually trying to make an interact-able faucet to my game, and hopefully I can reuse this script to make some clickable doors. XxDarkMiragexX 45 — 9y
0
So it would "script.Parent.Parent" since the script is inside a brick in the model, correct? XxDarkMiragexX 45 — 9y
Ad

Answer this question