Not Animating UI

Hello.

When I run my script. I don’t got a error or anything, just nothing happens. What I’m trying to do is when I run “:m blalbalalal” the UI tweens showing the text and all that. But when I type it out nothing happens with no print of an error. Please help me.

Server:

-- Heading --
	{
		Names = {'h'},
		Level = ModLvl,
		Function = function(Chatted,Arguements,Message)
			-- Check --
			if Message then
				local FilteredMsg = FilterMsg(Message,Chatted)
				AdminFolder.CrossClient:FireAllClients('h',{Chatted,FilteredMsg})
			end
		end,
	},
	-- Message --
	{
		Names = {'m'},
		Level = AdminLvl,
		Function = function(Chatted,Arguements,Message)
			-- Check --
			if Message then
				local FilteredMsg = FilterMsg(Message,Chatted)
				AdminFolder.CrossClient:FireAllClients('m',{Chatted,FilteredMsg})
			end
		end,
	},

Client:

--- [IMPORTANT] --
local function ClientEvent(Cmd,...)
	local Arguements = {...}
	-- Check --
	if Cmd == 'h' then
		local Plr = Arguements[1]
		local Msg = Arguements[2]
		HeadMessage(Plr,Msg)
	elseif Cmd == 'm' then
		local Plr = Arguements[1]
		local Msg = Arguements[2]
		BodyMessage(Plr,Msg)
	end
end
----

-- Finalize --
AdminFolder.CrossClient.OnClientEvent:Connect(ClientEvent)
----
1 Like

Hey there,

Issue:

AdminFolder.CrossClient:FireAllClients('m',{Chatted,FilteredMsg})

You see, in your Server-Client signal, your 2nd argument is a table containing Chatted and FilteredMsg.

When you’re receiving this signal on the client, you’re inserting the original table containing the arguments to another table:

local Arguements = {...}

What you’re doing here is basically inserting the original table as an element inside of another table on the client:

local Arguements = { {Chatted,FilteredMsg} }

Now when you try accessing Arguements[2] of this table, it returns nil considering it is only holding one element, which itself is a table containing your expected arguments.

Solutions:
In order to simply fix this, you can take out your arguments holder outside of the table in your ClentEvent() function:

local Arguements = ...

Another way you could fix this is by changing the way you access the expected values from the “nested” table that you have:

if Cmd == 'm' then
	local Plr = Arguements[1][1]
	local Msg = Arguements[1][2]
	BodyMessage(Plr,Msg)
end

Give it a shot and see if you manage to achieve the intended behavior. Please feel free to report back on any issues or anything I may have missed or misunderstood.

Im sorry, but I got a little confused. Do u think you could explain it in a simpler form?

Cause I did this right here. And it’s still doing the same thing.
image

image
Same thing when I do this

I don’t believe I’m noticing any immediate issues with the way you’ve implemented those changes. This leads me to believe that the issue may now be inside your BodyMessage() function, presuming that’s what’s handling the tweening and appearing of the GUI. If you’re able to post your BodyMessage() function, that may help point us in the right direction.

Additionally, it always helps to do some basic debugging, for example printing Plr or Msg after they’ve been assigned the correct value to see if those variables contain what you’re expecting them to.

Here:

function BodyMessage(Plr,Msg)
	local Container = ScreenGUI.BackGround:FindFirstChild('MContainer')
	local PlrCard = Container:FindFirstChild('Card')
	-- Set New Values --
	PlrCard.Avatar.Image = 'https://www.roblox.com/headshot-thumbnail/image?userId='..Plr.UserId..'&width=420&height=420&format=png'
	PlrCard.Chatter.Text = Plr.Name
	Container.Message.Text = Msg
	-- Flows --
	local VisiblizeImage = {ImageTransparency = 0}
	local VisiblizeText = {TextTransparency = 0}
	local VisiblizeBG = {Transparency = 0}
	-- Tween / PlrCard --
	TweenService:Create(PlrCard.Avatar,SmoothFlow,VisiblizeImage):Play()
	TweenService:Create(PlrCard.Avatar,SmoothFlow,VisiblizeBG):Play()
	TweenService:Create(PlrCard.Avatar.Stroke,SmoothFlow,VisiblizeBG):Play()
	TweenService:Create(PlrCard.Name,SmoothFlow,VisiblizeText):Play()
	-- Text --
	TweenService:Create(Container.Message,SmoothFlow,VisiblizeText):Play()
	---
	task.wait(MessageLength)
	-- Flows --
	local UnVisiblizeImage = {ImageTransparency = 1}
	local UnVisiblizeText = {TextTransparency = 1}
	local UnVisiblizeBG = {Transparency = 1}
	-- Tween / PlrCard --
	TweenService:Create(PlrCard.Avatar,SmoothFlow,UnVisiblizeImage):Play()
	TweenService:Create(PlrCard.Avatar,SmoothFlow,UnVisiblizeBG):Play()
	TweenService:Create(PlrCard.Avatar.Stroke,SmoothFlow,UnVisiblizeBG):Play()
	TweenService:Create(PlrCard.Name,SmoothFlow,UnVisiblizeText):Play()
	-- Text --
	TweenService:Create(Container.Message,SmoothFlow,UnVisiblizeText):Play()
end

Thank you.

PlrCard.Chatter.Text = Plr.Name

As I see here, you’re trying to access the Name property of the supposed Plr Instance, which I believe may be your issue here (or one of).

In your client signal here, :FireAllClients('m',{Chatted,FilteredMsg}), may I ask what exactly are the 2 elements of the table, Chatted and FilteredMsg? How are you getting them?

Chatted is the Player that chatted the message. And FilteredMsg is the Message but filtered so it doesn’t show any cuss words

I see, thank you.

As I mentioned here, it is always helpful to debug your code such as by simply printing certain checkpoints such as Plr.Name or Msg to assure the correct arguments are being parsed and processed. It is also important to look out for any potential errors that your code may be outputting. Have you checked your console for any errors that your LocalScript may be outputting?

These scripts aren’t local or server scripts.
It all runs off of a module but a server script excuses the entire code. But atp im too cofused

Assuming you use following server code:

Change

You should try changing your client script to this:

--- [IMPORTANT] --
local function ClientEvent(Cmd, tbl)
	local Arguements = tbl
	-- Check --
	if Cmd == 'h' then
		local Plr = Arguements[1]
		local Msg = Arguements[2]
		HeadMessage(Plr,Msg)
	elseif Cmd == 'm' then
		local Plr = Arguements[1]
		local Msg = Arguements[2]
		BodyMessage(Plr,Msg)
	end
end
----

-- Finalize --
AdminFolder.CrossClient.OnClientEvent:Connect(ClientEvent)
----

Alternative

unpacking Arguements

--- [IMPORTANT] --
local function ClientEvent(Cmd, Arguements)
	local Plr, Msg = unpack(Arguements) 
	-- Check --
	if Cmd == 'h' then
		HeadMessage(Plr,Msg)
	elseif Cmd == 'm' then
		BodyMessage(Plr,Msg)
	end
end
----

-- Finalize --
AdminFolder.CrossClient.OnClientEvent:Connect(ClientEvent)
----

I managed it fix it like this a while ago. Sorry I forgot to close down the topic

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.