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

Material of the "Part" (Made by the script) not changing?

So, i created a "Part" with a script:

local clickdetector = script.Parent:WaitForChild("ClickDetector")

clickdetector.MouseClick:Connect(function()
	game.Workspace.MEDIUM2.Transparency = 1
	game.Workspace.MEDIUM2.Position = Vector3.new(0,0,0)
	local part = Instance.new("Part")
	part.Position = Vector3.new(0,0,0)
	part.Name = "COLORCHANGE"
	part.Parent = game.Workspace
	part.Size = Vector3.new(100,100,100)
	wait(3)
	game.Workspace.MEDIUM2.Transparency = 0
	game.Workspace.MEDIUM2.Position = Vector3.new(121.199, 100, -309.035)
end)

And when i try to modify the Material of the "COLORCHANGE" it doesn't works. The script:

local clickdetector = script.Parent:WaitForChild("ClickDetector")

clickdetector.MouseClick:Connect(function()
	game.Workspace.Medium3.Transparency = 1
	game.Workspace.Medium3.Position = Vector3.new(0,0,0)
        part = game.Workspace.COLORCHANGE
        part.Material="Neon"
	game.Workspace.Medium3.Transparency = 0
	game.Workspace.Medium3.Position = Vector3.new(98.199, 100, -309.035)
end)

Why is the script not working?

1 comment

0

are these two totally separate scripts inside the same part?

1 answer

Here's one way to do it, I think this might help you a little.

local clickdetector = script.Parent:WaitForChild("ClickDetector")

clickdetector.MouseClick:Connect(function()
	script.Parent.Material = Enum.Material.Neon
end)

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