Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

MouseButton1Click Not Changing MeshPart Texture?

Asked by 7 years ago

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)
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). GoldenPhysics 474 — 7y
0
I tried that, didn't make a diffrence pluginfactory 463 — 7y
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. Kasumo 2 — 7y
0
Output? AstrealDev 728 — 7y
View all comments (2 more)
0
Output? AstrealDev 728 — 7y
0
no output pluginfactory 463 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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.

Ad

Answer this question