|
| 17 Feb 2017 10:24 AM |
| can someone get me a script that changes the CanCollide value from true to false when players touch it??? plzzzzz |
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 10:47 AM |
--[[ BrendonTheWizard 2017 Made for derfor11k --]] local cooldown = false; -- to prevent from firing too many times function cool() cooldown = true; wait(2); cooldown = false; print("Can touch again"); end function transparency() if script.Parent.CanCollide then script.Parent.Transparency = 0; elseif not script.Parent.CanCollide then script.Parent.Transparency = 0.4; end end script.Parent.Touched:Connect(function() if not cooldown then if (script.Parent.CanCollide) and not cooldown then -- if it is cancollide, make it false script.Parent.CanCollide = false transparency(); cool(); elseif (not script.Parent.CanCollide) and not cooldown then -- if it is not cancollide, make it true script.Parent.CanCollide = true; transparency(); cool(); elseif cooldown then end end end) |
|
|
| Report Abuse |
|
|
Vid_eo
|
  |
| Joined: 30 Jul 2013 |
| Total Posts: 2580 |
|
|
| 17 Feb 2017 11:03 AM |
way easier script:
--put the script in the part
debounce = false
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and deb == true then --[[checks for a humanoid, and checks if deb is true--]] deb = true --sets the debounce to true, so that the script can't run 2 many times script.Parent.CanCollide = false wait(4) script.Parent.CanCollide = true deb = false --sets debounce to false so that the scirpt can run again end end
This script is just changing the CanCollide value, not the transparency or anything.
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 11:05 AM |
that is a lot easier, though having separate functions + a transparency feature makes it easier to visualize both in-script and in-game imo
|
|
|
| Report Abuse |
|
|
Goadan
|
  |
| Joined: 14 Apr 2013 |
| Total Posts: 157 |
|
|
| 17 Feb 2017 12:30 PM |
@Vi_deo not sure why you need the debounce to be fair.
I Lua script , not much to it |
|
|
| Report Abuse |
|
|
Goadan
|
  |
| Joined: 14 Apr 2013 |
| Total Posts: 157 |
|
|
| 17 Feb 2017 12:31 PM |
It's not going to make tons of lag if it's just one brick changing I personally only use debounce if it's multiple bricks i'm making do something but I guess everyone is different
I Lua script , not much to it |
|
|
| Report Abuse |
|
|
| |
|