Error in script after localizing it

Hi, I know I did a post a few minutes ago although I need help, once again. Lol-

After localizing the script many times, this line keeps getting an error message regardless if I localize it etc.


game.ReplicatedStorage.Receive.OnClientEvent:Connect(function(msg)
	script.Parent.TextLabel.Text = msg
	script.Parent.Parent:TweenPosition(UDim2.new(-0.098, 0,-0.357, 0), "Out", "Sine", 0.5)
	wait(5)
	script.Parent.Parent:TweenPosition(UDim2.new(0,0,-1, 0), "Out", "Sine", 0.5)
end)

Error:

1 Like

you should use the tostring statement because the program is having error try to indentify it

game.ReplicatedStorage.Receive.OnClientEvent:Connect(function(msg)
	script.Parent.TextLabel.Text = tostring(msg)
	script.Parent.Parent:TweenPosition(UDim2.new(-0.098, 0,-0.357, 0), "Out", "Sine", 0.5)
	wait(5)
	script.Parent.Parent:TweenPosition(UDim2.new(0,0,-1, 0), "Out", "Sine", 0.5)
end)

Instead of the script opening the announcement clip, it moves my admin panel?

are u sure that this part of the script is where u want the position to be?

yes, that is the position for the announcement clip

i have test your script and the positoion GUI is going out of my screen all script work but there may be a mistake in your position

Got the main working, although now the reason doesn’t show up?

hmm i think there may be a mistake in your main script


script.Parent.MouseButton1Click:Connect(function()
	local ingameannouncement = script.Parent.Parent.IngameReason
	if ingameannouncement.Text ~= "" then
	if game.ReplicatedStorage.ifSend.Value == false then
		script.Parent.Parent.IngameReason.Text = ""
		game.ReplicatedStorage.sendAnnouncement:FireServer(ingameannouncement)
	else
		script.Parent.Text = "Hold your horses, cannot send now"
		wait(1)
	end
else
	script.Parent.Text = "Announce"
end
end)

i think you should put these if statement separately

Can you do:

game.ReplicatedStorage.Receive.OnClientEvent:Connect(function(msg)
    print(msg)
	script.Parent.TextLabel.Text = msg
	script.Parent.Parent:TweenPosition(UDim2.new(-0.098, 0,-0.357, 0), "Out", "Sine", 0.5)
	wait(5)
	script.Parent.Parent:TweenPosition(UDim2.new(0,0,-1, 0), "Out", "Sine", 0.5)
end)

and tell me what it prints?

it prints nothing, no reason why.

If it’s not printing anything, the error is on the server script that is firing the RemoteEvent for the client…

Why is the error on line two? You aren’t calling a function on line two except for Connect, which you are using correctly.

Exactly, I’m so confused because sometimes it does work but it doesn’t write out the message that was provided. I’ll provide the server script below;

local messaging = game:GetService("MessagingService")
local plr = game.Players.LocalPlayer

local success, errormsg, connection = pcall (function()
	messaging:SubscribeAsync("Announcements", function(msg)
		print(msg.Data)
		print(msg.Send)
		game.ReplicatedStorage.ifSend.Value = true
		game.ReplicatedStorage.Reci:FireAllClients(msg.Data)
		wait(5)
		game.ReplicatedStorage.ifSend.Value = false
	end)
end)

local success, errormsg = pcall(function()
		game.ReplicatedStorage.sendAnnouncement.OnServerEvent:Connect(function(player, msg)
			local rank = player:GetRankInGroup(9178694)
			if rank >= 11 then
				messaging:PublishAsync("Announcements")
			else
				warn("Your rank is not high enough to publish announcements!")
			end
	end)
	
	```

Was the LocalScript that you provided panel.announcements.AnnouncementClip.LocalScript and was that the full script?

The one I just provided above is the server script, the other one that I provided was the local script.