So, essentially, I’m trying to make a script so where if a player has a certain name, they’ll get a texture on the gun. I’ve tested it without the game.Players.LocalPlayer.Name and with basic variables. It works without any of that, it just stays the same texture if I add this.
My current script:
local function applyTextureToMeshParts(model)
local gunStuff = model:GetDescendants()
for i = 1, #gunStuff do
if gunStuff[i]:IsA("MeshPart") then
if game.Players.LocalPlayer.Name == "Comqts" then
gunStuff[i].TextureID = "rbxassetid://11201026227"
else
gunStuff[i].TextureID = "rbxassetid://0"
end
end
end
end
applyTextureToMeshParts(script.Parent)
just debug it using prints see where it all goes wrong
for i = 1, #gunStuff do
if gunStuff[i]:IsA("MeshPart") then
print(game.Players.LocalPlayer.Name)
if game.Players.LocalPlayer.Name == "Comqts" then
gunStuff[i].TextureID = "rbxassetid://11201026227"
else
gunStuff[i].TextureID = "rbxassetid://0"
end
end
end
local function applyTextureToMeshParts(model)
local gunStuff = model:GetDescendants()
for i = 1, #gunStuff do
if gunStuff[i]:IsA("MeshPart") then
if game.Players.LocalPlayer.Name == "Comqts" then
gunStuff[i].TextureID = "rbxassetid://11201026227"
else
gunStuff[i].TextureID = "rbxassetid://0"
end
end
end
end
applyTextureToMeshParts(script.Parent)
local function applyTextureToMeshParts(model)
local gunStuff = model:GetDescendants()
for i = 1, #gunStuff do
if gunStuff[i]:IsA("MeshPart") then
if game.Players.LocalPlayer.Name == "Comqts" then
gunStuff[i].TextureID = "rbxassetid://11201026227"
else
gunStuff[i].TextureID = "rbxassetid://0"
end
end
end
end
applyTextureToMeshParts(script.Parent)
local function applyTextureToMeshParts(model)
local gunStuff = model:GetDescendants()
for _,v in gunStuff do
if gunStuff[i]:IsA("MeshPart") then
if game.Players.LocalPlayer.Name == "Comqts" then
gunStuff[i].TextureID = "rbxassetid://11201026227"
else
gunStuff[i].TextureID = "rbxassetid://0"
end
end
end
end
applyTextureToMeshParts(script.Parent)
local function applyTextureToMeshParts(model)
local gunStuff = model:GetDescendants()
print("I found the de")
for _,v in gunStuff do
print("a de was found")
if gunStuff[i]:IsA("MeshPart") then
print("I found the de mesh")
if game.Players.LocalPlayer.Name == "Comqts" then
print("I found the him")
gunStuff[i].TextureID = "rbxassetid://11201026227"
print("I changed the texture yooooo")
else
print("I found the not him")
gunStuff[i].TextureID = "rbxassetid://0"
print("I found the not him and change the texture yooooo")
end
print("i dont know what function ended0")
end
print("i dont know what function ended1")
end
print("i dont know what function ended2")
end
print("i am DONE setting up the function now i will call it")
applyTextureToMeshParts(script.Parent)
print("ok i called it")