Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

MouseButton1Click Not Changing MeshPart Texture?

When the player clicks, the script is suppose to change the texture of a meshpart, but when the button is clicked, nothing happens. Any Idea Why?

SkinId = "rbxassetid://633490575"
Player = game.Players.LocalPlayer
Character = Player.Character
Aug = Character:WaitForChild("Aug")
Carbon = script.Parent.Parent.Parent.Parent.Parent.Skins:WaitForChild("carbon")

script.Parent.MouseButton1Click:connect(function()
	if Carbon == true then
	print("Skin Applied")
	Aug.TextureID = SkinId
	end
end)

6 comments

0

Did you check that it's getting past the :WaitForChild()? You can add a second argument to that to timeout after a given time like this :WaitForChild("carbon", 5).

0

I tried that, didn't make a diffrence

0

If it's not showing output, it's probably a problem with the texture. Try to subtract 1 from the skinId, and keep subtracting 1 until it loads.

0

Output?

0

Output?

0

no output

1 answer

You made a error with carbon. There are no value's in carbon. U should use this.

SkinId = "rbxassetid://633490575"
Player = game.Players.LocalPlayer
CarbonSkinApplied = false
Character = Player.Character
Aug = Character:WaitForChild("Aug")
Carbon = script.Parent.Parent.Parent.Parent.Parent.Skins:WaitForChild("carbon")

script.Parent.MouseButton1Click:connect(function()
    if CarbonSkinApplied == false then
    print("Skin Applied")
    CarbonSkinApplied = true
    Aug.TextureID = SkinId
    end
end)

You already added the function "WaitForChild" . And the function doesn't return a true or false. So u better just make ur own value's, and add the "WaitForChild" just with the value's.

This discussion is preserved as it was. New answers, comments, and votes are closed.