generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Whats wrong? HELP!

Previous Thread :: Next Thread 
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:25 AM
collide = true
for _,v in pairs(script.Parent.Parent:GetChildren())do
local function On()
        script.Parent.BrickColor = BrickColor.new("Bright green")
        v.CanCollide = true
local function Off()
        script.Parent.BrickColor = BrickColor.new("Really red")
        v.CanCollide = false
script.Parent.ClickDetector.Clicked:connect(function(onClick)
    if collide == true then
        Off()
    if collied == false then
        On()

    end
    end
end)
end
end
end
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:27 AM
Sorry here--

    collide = true
    for _,v in pairs(script.Parent.Parent:GetChildren())do
    local function On()
            script.Parent.BrickColor = BrickColor.new("Bright green")
            v.CanCollide = true
    local function Off()
            script.Parent.BrickColor = BrickColor.new("Really red")
            v.CanCollide = false
    script.Parent.ClickDetector.Clicked:connect(function(onClick)
        if collide == true then
            collide = false
            Off()
        if collide == false then
            collide = true
            On()
    
        end
        end
    end)
    end
    end
    end

Report Abuse
Xtreme101 is not online. Xtreme101
Joined: 03 Jan 2009
Total Posts: 4385
09 Aug 2013 11:37 AM
I'd say you have too many ends there but I suspect there's more to the script.

Output?
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
09 Aug 2013 11:38 AM
The problem is on() off() you need more specific names, I tried making a plugin with on() off() and it errored
collide = true
for _,v in pairs(script.Parent.Parent:GetChildren())do
local function TurnOn()
        script.Parent.BrickColor = BrickColor.new("Bright green")
        v.CanCollide = true
local function TurnOff()
        script.Parent.BrickColor = BrickColor.new("Really red")
        v.CanCollide = false
script.Parent.ClickDetector.Clicked:connect(function(onClick)
    if collide == true then
        collide = false
        TurnOff()
    if collide == false then
        collide = true
        TurnOn()

    end
    end
end)
end
end
end
Report Abuse
agentwaffle1234 is not online. agentwaffle1234
Joined: 18 Jul 2012
Total Posts: 50
09 Aug 2013 11:39 AM
I think you're mistaking "CanCollide=True" For "Collide=True"

~AgentWaffle~
Report Abuse
Xtreme101 is not online. Xtreme101
Joined: 03 Jan 2009
Total Posts: 4385
09 Aug 2013 11:40 AM
What? The entire post didn't load onto my screen when I initially saw it.
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:44 AM
I ended up with this but the only hting that worked was BrickColor.new = ("Bright green")

    collide = true
    for _,v in pairs(script.Parent.Parent:GetChildren())do
    local function TurnOn()
        script.Parent.BrickColor = BrickColor.new("Bright green")
        v.CanCollide = true
    end
    local function TurnOff()
        script.Parent.BrickColor = BrickColor.new("Really red")
        v.CanCollide = false
    end
    script.Parent.ClickDetector.MouseClick:connect(function(onClick)
        if collide == true then
        collide = false
        TurnOff()
    if collide == false then
        collide = true
        TurnOn()
    end
    end
    end)
    end
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
09 Aug 2013 11:52 AM
collide = true
for _,v in pairs(script.Parent.Parent:GetChildren())do
local function TurnOn()
    script.Parent.BrickColor = BrickColor.new("Bright green")
if v:IsA("Part") then v.CanCollide = true end
end
local function TurnOff()
    script.Parent.BrickColor = BrickColor.new("Really red")
   if v:IsA("Part") then v.CanCollide = false end
end
script.Parent.ClickDetector.MouseClick:connect(function(onClick)
    if collide == true then
    collide = false
    TurnOff()
if collide == false then
    collide = true
    TurnOn()
end
end
end)
end
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:56 AM
didnt work eather, same as mine only the color changed to green
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:57 AM
    collide = true
    for _,v in pairs(script.Parent.Parent:GetChildren())do
    script.Parent.ClickDetector.MouseClick:connect(function(onClick)
        if collide == true then
            script.Parent.BrickColor = BrickColor.new("Lime green")
            v.CanCollide = true
        collide = false
        TurnOff()
    end
        if collide == false then
            script.Parent.BrickColor = BrickColor.new("Really red")
            v.CanCollide = false
        collide = true
        TurnOn()
    end
    end)
    end

try these
it turns red but not green Lol
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 12:08 PM
Bump
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
09 Aug 2013 12:24 PM
Try mine
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:17 PM
doesnt work
Report Abuse
andrei012 is not online. andrei012
Joined: 05 Nov 2010
Total Posts: 279
09 Aug 2013 11:30 PM
Bump Help?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image