Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

6 comments

1

Any errors in the output? Is the game FilteringEnabled or not?

0

The game is not FilteringEnabled, I will check the output.

1

Is HPinkBridge a model? If so, you need to change the CanCollide and Transparency property of each part in the model HPinkBridge.

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

0

Nope it's a part. I'll try changing the name or something.

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?

1 answer

✓ Accepted answer

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?

This discussion is preserved as it was. New answers, comments, and votes are closed.