The line Warn.Text = Reason
writes to the console Unable to assign property Text. string expected, got Instance . Below I attach both script excerpts.
Player.Chatted:Connect(function(msg)
local Letters = utf8.len(msg)
local MaxCharacters = 30
local msg1
if Letters > MaxCharacters then
if switch then
local offset = utf8.offset(msg, MaxCharacters + 1) - 1
msg1 = string.sub(msg, 1, offset)
print("обрезано", msg1, Letters)
local Reason
Reason = "Blocked"
Radio.Sound:FireServer(Talk, Player)
Radio.Chat:FireServer(msg1)
Radio.Warn:FireServer(Reason)
end
else
if switch then
print("Все", msg, Letters)
Radio.Sound:FireServer(Talk, Player)
Radio.Chat:FireServer(msg)
end
end
end)
Radio.Warn.OnServerEvent:Connect(function(Reason)
local Warn = script.Parent.Warn
local TweenService = game:GetService("TweenService")
local tween1 = TweenService:Create(Warn, TweenInfo.new(0.4), {BackgroundTransparency = 0.7})
local tween2 = TweenService:Create(Warn, TweenInfo.new(0.4), {BackgroundTransparency = 1})
tween1:Play()
Warn.Text = Reason
wait(3)
tween2:Play()
Warn.Text = ""
end)