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

How to make a bridge appear and change properties when a button is clicked?

Asked by 8 years ago

So what I'm trying to do is make the pink bridge change some properties when the button (with clickdetector obviously) is clicked. However, for some reason it does not work. Strange, my scripts are pretty much like that all the time and they always work without question. Anyway.

function Click()

    game.Workspace.HPinkBridge.CanCollide = false
    wait(0.1)
    game.Workspace.HPinkBridge.Transparency = 0.6

end

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

There's no reason why it shouldn't work? Any ideas?

1
Any errors in the output? Is the game FilteringEnabled or not? M39a9am3R 3210 — 8y
0
The game is not FilteringEnabled, I will check the output. KingCamembert 57 — 8y
1
Is HPinkBridge a model? If so, you need to change the CanCollide and Transparency property of each part in the model HPinkBridge. tkddude2 75 — 8y
1
When I tested it, it worked perfectly for me. I put the part in workspace, and named it "HPinkBridge" like you did. I put a normal script in it and copy and pasted code and it works perfectly. If it's a model, then I can show you a better way if you have a lot of parts DeveloperSolo 370 — 8y
View all comments (2 more)
0
Nope it's a part. I'll try changing the name or something. KingCamembert 57 — 8y
0
This is weird. There's no output, nothing. Nothing interfeering. Does this happen quite often? Is there an external reason for this? Shall I classify as an SCP? KingCamembert 57 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

This doesn't really matter, but use a Anonymous Function, it'll make your code look prettier.

Re-coded with an anonymous function;

script .Parent.ClickDetector.MouseClick:connect(function()
    workspace.HPinkBridge.CanCollide=false
    wait(.1)
    workspace.HPinkBridge.Transparency=.6
end)

Also, is it a Local or Server Script?

Does it work in-game and not in studio or vise versa?

Ad

Answer this question