I'm making a Terminal and you have to touch a part to activate it. I know why my code isn't working - It's because 'playername' isn't a child of Players. What I am trying to do is make the part that touched the capture point be put into a string and the value of the string is what is searches for in 'game.Players'. There is a String inside the parent of the script that the name appears in when you step on it.
cap = script.Parent
playername = script.Parent.PlayerName
playersname = playername.Value
while true do
cap.Touched:connect(function(player)
script.Parent.PlayerName.Value = player.Parent.Name
local Touchy = game.Players.playersname
if Touchy.TeamColor == BrickColor.new("Bright red") then
print "Raider"
end
end)
wait(0.5)
end
Please help.

4 comments
Hope i helped :)
Thankyou - That was very useful.
Remember to click "Accept Answer" if it helped you.
I did!