I’m attempting to create a board in which changes the textlabel’s text to the user’s sent message, but I’m struggling on when the user leaves the platform - it doesn’t change the text when TouchEnded event was activated - however, it ignores it for some reason and I can’t identify the issue. What’s the concurrent issue here? The code’s:
local model = game.Workspace.Speaker
local board = model.Board
local speakerTouched = model.SpeakerTouch
local text = board.SurfaceGui.Frame.TextLabel
local changeText = false
game.Players.PlayerAdded:Connect(function(plr)
speakerTouched.Touched:Connect(function()
if plr:GetRankInGroup(3788654) == 255 then
if not changeText then
print(plr.Name.." is rank 255!")
plr.Chatted:Connect(function(message)
text.Text = message
end) end
else
print(plr.Name.." isn't rank 255!")
end end)
speakerTouched.TouchEnded:Connect(function()
changeText = true
return
end)
end)
-- this is in ServerScriptService
The entire script is perfectly fine, however, regardless of the response - I’m having issue with TouchEnded event, as I’m attempting to correspond when the player leaves, it doesn’t fire a signal to change the board’s text to their message when away.
game.Players.PlayerAdded:Connect(function(plr)
speakerTouched.Touched:Connect(function()
if plr:GetRankInGroup(3788654) == 255 then
if not changeText then
print(plr.Name.." is rank 255!")
plr.Chatted:Connect(function(message)
text.Text = message
end) end
else
print(plr.Name.." isn't rank 255!")
end end)
speakerTouched.TouchEnded:Connect(function()
changeText = true
return
end)
end)
I have already separated both functions, and yet it still fires a signal when a user talks AWAY from the platform that distributes the signal. I updated the code for concerns.