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

button script?

Asked by 10 years ago
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?

0
What are you exactly trying to do? gskw 1046 — 10y
0
make a button that make a platform appear... hiimcool34 0 — 10y

2 answers

Log in to vote
1
Answered by 10 years ago

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!

0
wow this is great, i didn't think about debounce. hiimcool34 0 — 10y
0
No problem. ;) TheeDeathCaster 2368 — 10y
0
why is it not creating ontouch? hiimcool34 0 — 10y
0
Nvm, I fixed it. hiimcool34 0 — 10y
View all comments (2 more)
0
There is something called FindService? Never heard of it, hmm. fireboltofdeath 635 — 10y
0
Ya, there is, I'm sure it is like the 'FindFirstChild()' string, but it finds the Service (Like Workspace, Lighting, NetworkServer, ect.) TheeDeathCaster 2368 — 10y
Ad
Log in to vote
0
Answered by
IcyEvil 260 Moderation Voter
10 years ago
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.

Answer this question