So I am trying to make a guess the logo type game. The problem is, for the minigame I am trying to make, I only want the person who actually guessed the logo to be allowed through the door instead of everybody. I have this script in a regular script:
local image = script.Parent.Check.ImageLabel
door = script.Parent
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name)
local decal = script.Parent:FindFirstChildOfClass('Decal')
msg = string.lower(msg)
local thecharacter = script.Parent.TheCharacter
print(msg)
print(thecharacter.Value)
print(script.Parent.TheCharacter2.Value)
if msg == string.lower(thecharacter.Value) or msg == string.lower(script.Parent.TheCharacter2.Value) then
local value = game.ReplicatedStorage.Value.Value
if value == true then
door.CanCollide = false
image.Visible = true
image:TweenPosition(UDim2.new(0.3, 0,0.3, 0), "Out",1)
door.Transparency = 0.7
decal.Transparency = 0.7
wait(3)
image:TweenPosition(UDim2.new(1, 0,0.3, 0), "Out",1)
wait(1)
image.Visible = false
image.Position = UDim2.new(-0.4, 0, 0.3, 0)
door.CanCollide = true
door.Transparency = 0
decal.Transparency = 0
end
end
end
game.Players.ChildAdded:connect(function(plr)
plr.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, plr) end)
end)
Obviously, this script is going to make the door transparent for all players. How would I make it so the door is only opened for the player who guessed it?
Just a few things before you comment, I want it to be time efficient. I have over 1000 of these doors so I don’t feel like changing the name of every door. I am fine with copy and pasting the script over and over inside each part.