Hello, I am trying to make a guess the character system, and I have successfully made the door system. I am now trying to make it so the player must be standing on a physical part/checkpoint in order for the door script to work as well.
Here is my current code for the door :
door = script.Parent
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name)
msg = string.lower(msg)
local char = script.Parent.TheCharacter
local aliases = string.split(char:GetAttribute("Alias"), ", ") -- using ', ' since that was what the attribute uses
local function unlockDoor()
door.CanCollide = false
door.Transparency = 0.7
wait(4)
door.CanCollide = true
door.Transparency = 0
end
if msg == string.lower(char.Value) then
unlockDoor()
else
for i, alias in pairs(aliases) do
if msg == string.lower(alias) then
unlockDoor()
break
end
end
end
end
game.Players.ChildAdded:connect(function(plr)
plr.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, plr) end)
end)
What I have tried
I have tried using a remote event for the Touched function but I could not manage to get it to work.