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

button script?

ontouch()

game.workspace.platform.cancolide= false
game.workspace.playform.transparency (1)

wait (10)

game.workspace.platform.cancolide= true
game.workspace.playform.transparency (0) 

can someone help make this work?

2 comments

0

What are you exactly trying to do?

0

make a button that make a platform appear...

2 answers

Here, try this instead;

local debounce = false --I added debounce

if game:FindService("Workspace")and game.Workspace:FindFirstChild("PartNameHere")then --If script finds the service 'workspace' and finds PartNameHere (Switch the PartNameHere parts with the part you want the script to work on) then it will do the below \/
game.Workspace.PartNameHere.Touched:connect(function() --If touched then
if not debounce then --If debounce is false
debounce = true --Returns debounce to true
game.Workspace.PartNameHere.CanCollide = false --Walk-Throughable
game.Workspace.PartNameHere.Transparency = 1 --Invisible

wait(10) --Waits 10 before can be touched again
debounce = false --Returns debounce false again
game.Workspace.PartNameHere.CanCollide = true --Not Walk-Throughable anymore
game.Workspace.PartNameHere.Transparency = 0 --Visible again
end end)end --All the ends for the 'if' statements and that event up there

I hope this helped!

6 comments

0

wow this is great, i didn't think about debounce.

0

No problem. ;)

0

why is it not creating ontouch?

0

Nvm, I fixed it.

0

There is something called FindService? Never heard of it, hmm.

0

Ya, there is, I'm sure it is like the 'FindFirstChild()' string, but it finds the Service (Like Workspace, Lighting, NetworkServer, ect.)

function onTouched(hit)
h = game.Workspace:FindFirstChild("Humanoid")
game.workspace.platform.CanCollide= false
game.workspace.platform.Transparency=("1")
wait (10)
game.workspace.platform.CanCollide=true
game.workspace.platform.Transparency=("0")
end

script.Parent.touched:connect(onTouched)

Spelling and Capitalization Count In scripting.

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