Been looking into this for around an hour; I’m relatively new to roblox dev-forum and I’m not exactly sure how to check up on new studio updates and changes.
Last night I coded a player-list with User-profile, rank and username all worked fine. this evening when I started to further develop it, it just doesn’t work, no outputs nothing, as I mentioned above it worked perfectly like last, and now no changes made it’s not working! sorry for the repetitiveness
here is my script for reference!
local Parent = script.Parent
local ClickSound = Parent.Click
local Group = 15777400
local MinStaffRank = 100
local HttpService = game:GetService("HttpService")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Event = ReplicatedStorage.Events.StaffPlayerList
local CommsFrame = Parent.CommsFrame
local StaffList = CommsFrame.PlayerList.StaffList
local PlayerTemplate = CommsFrame.PlayerList.PlayerTemplate
function OnPlayerJoined()
Event.OnClientEvent:Connect(function(Player,Rank,MinRank)
for _,Staff in pairs(Players:GetChildren()) do
PlayerTemplate:Clone()
if MinRank then return end
PlayerTemplate.User.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..Staff.userId.."&width=420&height=420&format=png"
PlayerTemplate.Username.Text = Staff.Name
PlayerTemplate.Rank.Text = Rank
PlayerTemplate.Parent = StaffList
end
end)
end
function OnPlayerJoined()
Event.OnClientEvent:Connect(function(Player,Rank,MinRank)
for _,Staff in pairs(Players:GetChildren()) do
local new = PlayerTemplate:Clone()
if MinRank then return end
new.User.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..Staff.userId.."&width=420&height=420&format=png"
new.Username.Text = Staff.Name
new.Rank.Text = Rank
new.Parent = StaffList
end
end)
end
should be something like this since the :Clone() function returns the clone so you store it as a variable
Hi again, my problem wasn’t that it was just that when I test it nothing happens, the template stays the same, it’s parent isnt the staff list, and the profile nor the name nor the rank changes!
Well you put your Remote event code inside of OnPlayerJoined - it should be outside of it since you only need to do it once since it works for every player - and is the event being fired?
edit - realized it was client and also what is the point of putting player for the event when you make a clone for every player in the game?
I get the a studio error “Attempt to connect failed: Passed value is not a function”, I’m not sure what it means!
Again sorry if I’m being a pain I have quite bad anxiety (I’m not trying to guilt-trip you)
function OnPlayerJoined()
stuff when someone joins
end
Event.OnClientEvent:Connect(function(Player,Rank,MinRank)
for _,Staff in pairs(Players:GetChildren()) do
PlayerTemplate:Clone()
if MinRank then return end
PlayerTemplate.User.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..Staff.userId.."&width=420&height=420&format=png"
PlayerTemplate.Username.Text = Staff.Name
PlayerTemplate.Rank.Text = Rank
PlayerTemplate.Parent = StaffList
end
end)