I want the script to update the text label with the player’s Display Name when they’re standing in a part with CanCollide turned off.
I have tried to edit the code to try and work with this, but it doesn’t seem to work
I would appreciate it if someone could point me in the right direction for solving this. Thank you
The working code when CanCollide is turned ON for the part
local screenCover = script.Parent.Parent
local djLabel = script.Parent
local djBooth = workspace:FindFirstChild("DJBooth")
while true do
local touchingParts = djBooth:GetTouchingParts()
local player = nil
for _, part in ipairs(touchingParts) do
local parent = part.Parent
if parent and parent:IsA("Model") and parent:FindFirstChild("Humanoid") then
player = game:GetService("Players"):GetPlayerFromCharacter(parent)
break
end
end
if player then
djLabel.Text = "DJ: "..player.DisplayName
else
djLabel.Text = "AutoDJ"
end
wait(0.5)
end