Why is my tween not playing?

Hey guys I really do not know what I’m doing wrong here, everything is supposed to work as intended. So I basically fired a remote event from a server script so I can alert the player if a command failed. It didnt work, like I literally printed message and object right above the tween once and it showed the correct value
It showed me that everything had been passed down correctly.

It’s just that the tween is not working.

local TweenService = game:GetService("TweenService")


local MessagePlayer = game:GetService("ReplicatedStorage").Events.UI.MessagePlayer
local MessageAllClients = game:GetService("ReplicatedStorage").Events.UI.MessageAllClients

local Group = game:GetService("StarterGui").dev.alerts.notify



local function sendtoplayer(message,object)
	local Debounce = true
	for _, TextLabel in pairs(Group:GetChildren()) do
		if TextLabel.Name == object then
			TextLabel.Text = tostring(message)
			print(TextLabel.Text, object)
			if Debounce then
				Debounce = false
				TweenService:Create(TextLabel, TweenInfo.new(1), { TextTransparency = 0 }):Play()
				TweenService:Create(TextLabel.UIStroke, TweenInfo.new(1), {Transparency = 0 }):Play();task.wait(3)
				TweenService:Create(TextLabel, TweenInfo.new(1), { TextTransparency = 1 }):Play()
				TweenService:Create(TextLabel.UIStroke, TweenInfo.new(1), {Transparency = 1 }):Play()
				Debounce = true
			end
		end
	end
end


local function sendtoallclients(message)
	return nil
end



MessagePlayer.OnClientEvent:Connect(sendtoplayer)
MessageAllClients.OnClientEvent:Connect(sendtoallclients)


My original script was through the use of modular scripts(that brought problems of its own,inheritance etc) please help me.

What is Group defined as? If you’re editing this in StarterGui, it won’t show for the player.

(Also, if this is on the server, try to control all gui things on the client)

2 Likes

Add a local condition at the top that includes service, because you don’t specify it, so “TweenService:Create” doesn’t work at all

local TweenService = game:GetService("TweenService")

2 Likes

Nevermind, I misread.
:stuck_out_tongue:

Too early for me.

I have everything defined I just sent a snippet of my code

local TweenService = game:GetService("TweenService")


local MessagePlayer = game:GetService("ReplicatedStorage").Events.UI.MessagePlayer
local MessageAllClients = game:GetService("ReplicatedStorage").Events.UI.MessageAllClients

local Group = game:GetService("StarterGui").dev.alerts.notify



local function sendtoplayer(message,object)
	local Debounce = true
	for _, TextLabel in pairs(Group:GetChildren()) do
		if TextLabel.Name == object then
			TextLabel.Text = tostring(message)
			print(TextLabel.Text, object)
			if Debounce then
				Debounce = false
				TweenService:Create(TextLabel, TweenInfo.new(1), { TextTransparency = 0 }):Play()
				TweenService:Create(TextLabel.UIStroke, TweenInfo.new(1), {Transparency = 0 }):Play();task.wait(3)
				TweenService:Create(TextLabel, TweenInfo.new(1), { TextTransparency = 1 }):Play()
				TweenService:Create(TextLabel.UIStroke, TweenInfo.new(1), {Transparency = 1 }):Play()
				Debounce = true
			end
		end
	end
end


local function sendtoallclients(message)
	return nil
end



MessagePlayer.OnClientEvent:Connect(sendtoplayer)
MessageAllClients.OnClientEvent:Connect(sendtoallclients)
1 Like

You’re editing the labels in StarterGui, this is the problem. You need to edit each player’s PlayerGui. I’d suggest using a RemoteEvent to tell the clients what to and when to play the tween.

2 Likes

First: StarterGui is an STARTER Gui. Not player’s GUI. Use PlayerGui.
Second: Use for to tween multiple objects.

2 Likes

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