I’ve been trying to get a Template to be Clone from ServerStorage with a Server Sided Script, every time a player joins but it seems that the Server Script doesn’t want to Clone the Template. If anyone could help out, that would be great, here’s the script
local list = script.Parent.backgr.Frame.ScrollArea
local Template = game.ServerStorage.Template
local function plrJoined(plr)
if not list:FindFirstChild(plr.Name) then
local plrTemp = Template:Clone()
plrTemp.Display.Text = plr.DisplayName
plrTemp.User.Text = plr.Name
plrTemp.Parent = list
print("test")
end
end
local function plrLeft(plrLeft)
if list:FindFirstChild(plrLeft.Name) then
list:FindFirstChild(plrLeft.Name):Destroy()
else
print("Nothing to Remove")
end
end
--------------------------------------------
while wait() do
if game.Players.PlayerAdded then
plrJoined()
elseif game.Players.PlayerRemoving then
plrLeft()
end
end
When you are detecting PlayerAdded, you are executing plrJoined(). You are not providing the player argument, which the function seems to require to run.
I recommend using a function such as
game.Players.PlayerAdded:Connect(function(plr)
--Put your code from the function here.
end)