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

Script won't work, why?

Asked by 10 years ago

I'm making a "name that character" script; when you say the right word you'll pass through. But, when I play the game i can just go through all of them help me!!!

local door = script.Parent game.Players.PlayerAdded():connect(function(player) player.Chatted:connect(function(msg) if msg == "msg" then door.CanCollide = false door.Transpareny = 1 wait(3) door.CanCollide = true door.Transparency = 0 end end end

1
Code block, plz. Tesouro 407 — 10y

3 answers

Log in to vote
2
Answered by
Ekkoh 635 Moderation Voter
10 years ago
local door = script.Parent 
-- you don't need the () after PlayerAdded
game.Players.PlayerAdded:connect(function(player) 
    player.Chatted:connect(function(msg) 
        if msg:lower() == "msg" then -- i used the lower method so it's not case-sensitive
            door.CanCollide = false 
            door.Transpareny = 1 
            wait(3) 
            door.CanCollide = true 
            door.Transparency = 0 
        end 
    end) -- you need closing parentheses on these two ends because your connecting the function to the event anonymously 
end)
Ad
Log in to vote
-1
Answered by 10 years ago

change the message to something else.

0
That's not the problem. Ekkoh 635 — 10y
Log in to vote
-1
Answered by 10 years ago

Change the if msg =="to the characters name in the picture"

0
I do that but wont work Angeldeath13 0 — 10y

Answer this question