I have a custom StarterCharacter in my StarterPlayer folder so that everyone looks the same when they join the game.
I also have a room where players can customize their appearance, but these always get reset on death or when a player resets their character. (The same with armors)
I know when you give a character a tool and you put it in their StarterPack, they will keep it upon death, but how do I override the StarterCharacter so that players don’t have to customize their look after every death?
Here is the code for the script inside faces for example. This is a free model from the Library.
function getDecal()
decals = {}
for i,child in pairs(script.Parent:getChildren()) do
if child.className == "Decal" then
table.insert(decals, child)
end
end
if #decals ~= 0 then
return decals[math.random(1, #decals)]
end
return nil
end
function onTouch(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local head = hit.Parent:findFirstChild("Head")
if head ~= nil then
local face = head:findFirstChild("face")
if face.Texture ~= getDecal().Texture then
face.Texture = getDecal().Texture
end
end
end
end
script.Parent.Touched:connect(onTouch)
and the main script that came with all the faces:
Print_Scan_Results = true --Prints the results of each scan in the output window.
------------------------------------------------
Quarantine_Instead_of_Delete = true --Quarantines all malicious objects into the Lighting Directory for you to view, after making all hidden objects visable.
------------------------------------------------
--Script Created by Abdulilah2001
q = Instance.new("Model")
q.Name = "Quarantine"
classes = {"AutoJoint", "BackpackItem", "Feature", "Glue", "HtmlWindow", "JointInstance", "LocalBackpack", "LocalBackpackItem", "MotorFeature", "Mouse", "Rotate", "RotateP", "RotateV", "Snap", "StockSound", "VelocityMotor", "Weld", "Geometry", "Timer","ChangeHistoryService"}
names = {"Infected", "ROFL", "Snap Reducer", "SnapReducer", "Snap-Reducer", "Anti-Lag", "Anti Lag", "AntiLag", "Wildfire", "AntiVirus", "Anti-Virus", "Anti Virus", "4D Being", "No samurai plzzz", "OHAI", "VIRUS", "Guest_Talking_Script", "Guest Free Chat Script", "lol", "LOL", "bob", "BOB", "Snap Remover", "SnapRemover"}
hidden = Instance.new("StringValue")
file = {}
function Start()
workspace = game.Workspace:GetChildren()
qu = q:GetChildren()
index = {}
virus = 0
function Scan(object)
for i = 1,#object do
inside = object[i]:GetChildren()
if Malicious(object[i]) then
virus = virus+1
Name(object[i])
Quarantine(object[i])
else
if #inside > 0 then
Scan(inside)
end
end
end
end
function Malicious(class)
for x = 1, #classes do
if class.className == classes[x] and #(class:GetChildren()) > 0 then return true end
end
for x = 1, #names do
if string.lower(class.Name) == string.lower(names[x]) then return true end
end
return false
end
function Hidden(class)
for x = 1, #classes do
if class.className == classes[x] then return true end
end
return false
end
function Name(malware)
cur = malware
file[1] = "."..cur.Name
while cur.Parent.Name ~= "Workspace" do
cur = cur.Parent
file[#file+1] = "."..cur.Name
end
inde = "game.Workspace"
for j = 1, #file do
inde = inde..file[#file+1-j]
end
file = {}
inde = inde.." ("..malware.className.." Class)"
index[#index+1] = inde
malware.Parent = q
end
function Quarantine(malware)
if malware ~= nil then
contain = malware:GetChildren()
if Hidden(malware) then
h = hidden:clone()
h.Name = malware.Name
h.Value = "Original Class: "..malware.className
h.Parent = malware.Parent
for j = 1, #contain do
contain[j].Parent = h
end
malware:remove()
malware = h
end
contain = malware:GetChildren()
for j = 1, #contain do
Quarantine(contain[j])
end
end
end
Scan(workspace)
if virus > 0 and Quarantine_Instead_of_Delete then
q.Parent = game.Lighting
end
if virus > 0 and Print_Scan_Results then
print("--------------------")
print("Scan Results:")
print("Potentially malicious objects were found in the following locations:")
for i = 1, #index do
print(" -- "..index[i])
end
if Quarantine_Instead_of_Delete then
print("These objects have been quarantined to the Lighting Directory.")
else
print("These objects have been removed.")
end
print("--------------------")
Start()
wait()
Start()
end
end
Start()
game.Workspace.ChildAdded:connect(Start)
Any help is appreciated.
Thanks!