Hi, I’m Drippy and my remote event will not fire.
I can’t figure out why it does this but hopefully someone else can.
I made sure all the locals, tittles and other small mistakes are not with in the error.
When I check the output, it shows no error.
It’s like it’s not detecting when the button clicks but I have a piece of code for that too.
Info UI Script:
local event = game.ReplicatedStorage:WaitForChild("PromoPanelInfo")
local Holder = script.Parent
local DName = Holder:WaitForChild("Name")
local CRank = Holder:WaitForChild("CurrentRank")
local UID = Holder:WaitForChild("UserId")
event.OnClientEvent:Connect(function(Name, Rank, ID)
Holder:TweenPosition(UDim2.new(0.542, 0, -0.002, 0), "In", "Bounce", 0.6, false)
DName.Text = Name
CRank.Text = Rank
UID.Text = ID
end)
Player UI Script:
local plrList = script.Parent.List
local sample = script.Sample
local event = game.ReplicatedStorage:WaitForChild("PromoPanelInfo")
local Name
local Rank
local ID
function clearList()
for _, item in pairs(plrList:GetChildren()) do
if item:IsA("TextLabel") then
item:Destroy()
end
end
end
function fillList()
clearList()
for _, player in pairs(game.Players:GetChildren()) do
if not plrList:FindFirstChild(player.Name) then
local new = sample:Clone()
new.Name = player.Name
new.Text = player.Name
new.Parent = plrList
Name = player.Name
Rank = player:GetRankInGroup(5676221)
ID = player.UserId
new.MouseButton1Click:Connect(clicked)
end
end
plrList.CanvasSize = UDim2.new(0, 0, 0, plrList.UI.AbsoluteContentSize.Y)
end
function clicked()
event:FireServer(Name, Rank, ID)
script.Parent:TweenPosition(UDim2.new(-0, 0, -0.002, 0), "In", "Bounce", 0.6, false)
end
fillList()
game.Players.PlayerAdded:Connect(fillList)
game.Players.PlayerRemoving:Connect(fillList)
If you could help that would be greatly appreciated.
When you fire from Client to Server, it will fire the player as well. So the Info UI Script should be:
local event = game.ReplicatedStorage:WaitForChild("PromoPanelInfo")
local Holder = script.Parent
local DName = Holder:WaitForChild("Name")
local CRank = Holder:WaitForChild("CurrentRank")
local UID = Holder:WaitForChild("UserId")
event.OnClientEvent:Connect(function(player, Name, Rank, ID)
Holder:TweenPosition(UDim2.new(0.542, 0, -0.002, 0), "In", "Bounce", 0.6, false)
DName.Text = Name
CRank.Text = Rank
UID.Text = ID
end)
the only thing that changed here is event.OnClientEvent:Connect(function(Name, Rank, ID), which became event.OnClientEvent:Connect(function(player, Name, Rank, ID) . The player that fires the remote will be put as first object so that the server knows who fires it. It should always start with player and then the other objects.
the clicked() function isn’t getting triggered anywhere. Also when the players gets added it does the fillList() function, but when it gets removed, it’s also fillList. Shouldn’t it be clearList()?
function fillList()
clearList()
for _, player in pairs(game.Players:GetChildren()) do
if not plrList:FindFirstChild(player.Name) then
local new = sample:Clone()
new.Name = player.Name
new.Text = player.Name
new.Parent = plrList
Name = player.Name
Rank = player:GetRankInGroup(5676221)
ID = player.UserId
new.MouseButton1Click:Connect(clicked)
oh alright no problem, but about your problem. the clicked() function isn’t getting triggered anywhere tho. When is the clicked function supposed to get triggered? when a button is clicked or …?
local plrList = script.Parent.List
local sample = script.Sample
local event = game.ReplicatedStorage:WaitForChild("PromoPanelInfo")
local Name
local Rank
local ID
function clearList()
for _, item in pairs(plrList:GetChildren()) do
if item:IsA("TextLabel") then
item:Destroy()
end
end
end
function clicked()
event:FireServer(Name, Rank, ID)
script.Parent:TweenPosition(UDim2.new(-0, 0, -0.002, 0), "In", "Bounce", 0.6, false)
end
function fillList()
clearList()
for _, player in pairs(game.Players:GetChildren()) do
if not plrList:FindFirstChild(player.Name) then
local new = sample:Clone()
new.Name = player.Name
new.Text = player.Name
new.Parent = plrList
Name = player.Name
Rank = player:GetRankInGroup(5676221)
ID = player.UserId
new.MouseButton1Click:Connect(function()
clicked()
end)
end
end
plrList.CanvasSize = UDim2.new(0, 0, 0, plrList.UI.AbsoluteContentSize.Y)
end
fillList()
game.Players.PlayerAdded:Connect(fillList)
game.Players.PlayerRemoving:Connect(fillList)
Well, that’s where it’s receiving the function, but the call is in the other script. And I’m having the prob while trying to call the function so I’m pretty sure that I think the problem is there.
My answer sounded like a smart answer, but it was not meant to be.
Could you try this and show me the output? It just prints “success” so that i know if the problem is there or not
local plrList = script.Parent.List
local sample = script.Sample
local event = game.ReplicatedStorage:WaitForChild("PromoPanelInfo")
local Name
local Rank
local ID
function clearList()
for _, item in pairs(plrList:GetChildren()) do
if item:IsA("TextLabel") then
item:Destroy()
end
end
end
function fillList()
clearList()
for _, player in pairs(game.Players:GetChildren()) do
if not plrList:FindFirstChild(player.Name) then
print("success")
local new = sample:Clone()
new.Name = player.Name
new.Text = player.Name
new.Parent = plrList
Name = player.Name
Rank = player:GetRankInGroup(5676221)
ID = player.UserId
new.MouseButton1Click:Connect(clicked)
end
end
plrList.CanvasSize = UDim2.new(0, 0, 0, plrList.UI.AbsoluteContentSize.Y)
end
function clicked()
event:FireServer(Name, Rank, ID)
script.Parent:TweenPosition(UDim2.new(-0, 0, -0.002, 0), "In", "Bounce", 0.6, false)
end
fillList()
game.Players.PlayerAdded:Connect(fillList)
game.Players.PlayerRemoving:Connect(fillList)
this is because the Info UI Script is in a Local script.
You have 2 options depending on the situation:
You change the Info UI Script to a server script
You use a bindable event instead of a remote event. Bindable event are used to communicate between client and client or server and server. Make sure to use :Fire instead of :FireServer and .Event instead of OnServerEvent