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

How do i fix my chat command? I made this today and it is broken please help me

Hello, well i don't really need to make the chat command only for specific players but i would appreciate it. Well please fix my script.

d1 = game.Workspace.Door
d2 = game.Workspace.Door2

game.Players.ChildAdded:connect(function(Player)
    Player.Chatted:connect(function(msg)
        if msg == "open2" then
	d1.Transparency = 0.5
	d2.Transparency = 0.5
	d1.BrickColor = ("Forest green")
	d2.BrickColor = ("Forest green")
	d1.CanCollide = false
	d2.CanCollide = false
        end
    end)
end)

IDK Why it doesn't change the color of part, and make the cancollide false. The only thing it does is make transparency 0.5 if someone could fix this script for me and maybe make it like true admin that has like admin list it would be really helpful for me. I am pretty basic in lua and i can't do anything advanced.

13 comments

1

here

1

lol

1

Is there no delay between comments

1

bro ur 3 years late

1

wait idk

1

I think you get 1 rep

1

for

1

lolllllllllllllllllllllll

1

upvoting

1

comments

1

lmao this is gay

1

keep doing it

1

ah

2 answers

✓ Accepted answer
d1 = game.Workspace.Door
d2 = game.Workspace.Door2

game.Players.ChildAdded:connect(function(Player)
    Player.Chatted:connect(function(msg)
        if msg == "open2" then
    d1.Transparency = 0.5
    d2.Transparency = 0.5
    d1.BrickColor = BrickColor.new("Forest green")
    d2.BrickColor = BrickColor.new("Forest green")
    d1.CanCollide = false
    d2.CanCollide = false
        end
    end)
end)

A simple fix, really. When changing a color of a brick, or a few other things, you must use BrickColor.new.

Refer here for more information.

1 comment

1

Thanks

pff I can do alot better than the person above. try this.

d1 = game.Workspace.Door1
d2 = game.Workspace.Door2
game.Players.ChildAdded:connect(function(Player)
	print(Player.Name)
    Player.Chatted:connect(function(msg)
	print(Player.Name .. ": " .. msg)
        if msg:lower() == "open" then
    d1.Transparency = 0.5
    d2.Transparency = 0.5
    d1.BrickColor = BrickColor.new("Forest green")
    d2.BrickColor = BrickColor.new("Forest green")
    d1.CanCollide = false
    d2.CanCollide = false
elseif msg:lower()	 == 'close' then
	
	    d1.Transparency = 0
    d2.Transparency = 0
    d1.BrickColor = BrickColor.new("Really red")
    d2.BrickColor = BrickColor.new("Really red")
    d1.CanCollide = true
    d2.CanCollide = true
        end
    end)
end)

2 comments

0

well, my end result was

0

was?

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