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

I simply cant get it to work.. why is that happening??

Asked by
Gigaset39 111
2 years ago
Edited 2 years ago

what im tring to do is to choose if the plataform(which is a part) CanCollide proprety is false or true depending on the color of a brick called randomAll

    local P = workspace.Plataform
    local randomAll = workspace.Colour.Randomizer  --- Colour is a folder and Randomizer is a part


   while true do

   if randomAll.BrickColor.Color == BrickColor.new("New Yeller") then
    P.CanCollide = false 
   end

    if randomAll.BrickColor.Color == BrickColor.new("Really black") then
      P.CanCollide = false 
    end

    end

please,someone tell me whats wrong whit this? i tied a lot of others combinations No errors, just that when the script reaches this part,it just skips it..

0
im noob at scripting. Gigaset39 111 — 2y
0
is BrickColour readeble?cause i know it can be changed i mean.like an user id, you can ”see it”, but you cant change it. Gigaset39 111 — 2y
0
Add a wait() , should help a lot :D VitroxVox 884 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

Hello Gigaset39, It didn't take me long to figure out the problem, and after testing it out on Studio, It seems to be working:

Your Code:

if randomAll.BrickColor.Color == BrickColor.new("New Yeller") then
 P.CanCollide = false 
end

My Solution:

if randomAll.BrickColor == BrickColor.new("New Yeller") then
 P.CanCollide = false 
end

As you can see the only thing I did was remove "Color" from "BrickColor"

"Color" is a property of "BrickColor", yet it also is a property of Part

And by the way, remember to add a wait() in your loops

And that's it!

On the other side, if you for some reason wanted to change the Color Property and not the BrickColor property, it'd be different, as you don't use "BrickColor.new" on the Color Property, instead, It would be something like this:

randomAll.Color = Color3.new(248, 248, 248)

But that isn't necessary on this case

Hope this helps!

Full Code:

 local P = workspace.Plataform
 local randomAll = workspace.Colour.Randomizer  --- Colour is a folder and Randomizer is a part


while true do
wait(0.01)

if randomAll.BrickColor == BrickColor.new("New Yeller") then
 P.CanCollide = false 
end

 if randomAll.BrickColor == BrickColor.new("Really black") then
   P.CanCollide = false 
 end

 end
1
idk why, but it works, i tryed that too,but it didint work,so i supose the problem was another one,thanks. Gigaset39 111 — 2y
Ad

Answer this question