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

How do you add a script where you have the type the name to get past?

Asked by 10 years ago

I'm thinking of making a "Name That Character"game ,in the "Name That Character" game, I want to make a script where you have to say the name of the decal? And also after you the name of the decal, isn't it CanCollide, and Transparency?

0
Isn't it something like this Angeldeath13 0 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

door = script.Parent --this is the door

function onChatted(msg, recipient, speaker)

-- convert to all lower case

local source = string.lower(speaker.Name) msg = string.lower(msg)

if (msg == "name") then door.CanCollide = false door.Transparency = 0.7 wait(3) door.CanCollide = true door.Transparency = 0 end

end

function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end

game.Players.ChildAdded:connect(onPlayerEntered)

0
The problem is does both of them work? Angeldeath13 0 — 10y
Ad
Log in to vote
0
Answered by
TofuBytes 500 Moderation Voter
10 years ago

You would use OnChatted events to pick up when the player chats the name of the character.

This script should go inside of your door with the image.

local door = script.Parent

game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg == "open" then --'open' is the name of the character or person you want them to say. (It is case sensitive)
door.CanCollide = false
door.Transparency = 1
wait(3)
door.CanCollide = true
door.Transparency = 0
end
end)
end)

Answer this question