So i wanted to change the text label when a player is switching teams or is in a team that satisfy my code’s condition. Also, when a player is interacting with a proximity prompt.
Problem:
It didnt change.. nothing is showing in the console.
Basically i tried adding some debug statements but again it didnt show up.
Note: Yes that is the literal names of the team
local function updateText(message)
textObject.Text = message
end
local function updateTextOnTeamChange(player)
local teamService = game:GetService("Teams")
if teamService then
local playerTeam = teamService:GetPlayerTeam(player)
if playerTeam then
local teamName = playerTeam.Name
if teamName == "Starting Point <3" then
updateText("Enter a portal to start~!")
elseif teamName == " Playing ~ !!" then
updateText("Checkpoint : ")
elseif teamName == "Finish Line ^w^" then
updateText("You finished the tower!")
else
updateText("An error occurred!")
warn("Unknown player team: " .. teamName)
end
else
updateText("You are not on any team")
end
else
warn("Teams service not found!")
updateText("An error occurred! Please try again later.")
end
end game.Players.PlayerAdded:Connect(function(player)
print("Player added:", player.Name) -- Debugging statement
player:GetPropertyChangedSignal("Team"):Connect(function()
print("Team changed for player:", player.Name) -- Debugging statement
updateTextOnTeamChange(player)
end)
end)
this is for the proximity prompt
local trigger = checkpoint:FindFirstChild("ProximityPrompt")
if trigger then
trigger.Triggered:Connect(function(player)
if player == game.Players.LocalPlayer then
print("Checkpoint triggered successfully.. Proceeding to update checkpoint " .. checkpoint.Name)
checkpoint.Transparency = 1
updateText("Checkpoint: " .. checkpoint.Name)
else
updateText("Error occurred!")
warn("Objects not found")
end
end)
end
any feedbacks is greatly appreciated ~!!!