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

Material Determination Script [IS IT FUNCTIONAL?] (NOT SOLVED)

Asked by 10 years ago

Basically, in this script I'm creating, it detects the part's name, and then inserts a texture onto the part, according to the name. I'm wondering if what I've written so far is correct.

while true do
    function determineMaterial()
        if Part.Name == "MetalWall001"
            then
        local metal001 = Instance.new.Texture
        metal001.Texture = "http://www.roblox.com/asset/?id=190629879"
        metal001.Face = "Left"
        metal001.Face = "Right"
        metal001.Face = "Back"
        metal001.Face = "Front"
        local metal001a = instance.new.Texture
        metal001a.Texture = "http://www.roblox.com/asset/?id=190629867"
        metal001a.Face = "Top"
        end
    end
end

2 answers

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

You have many, many problems here.

  • There is no wait() in the while loop; it will crash your game.

  • The function is never called, so it will never run.

  • Part will cause an error; there is no Part variable defined anywhere in the script.

  • The correct format for creating new instances is Instance.new("InstanceName", parent)

  • You never set the parent of the Texture created, so it will not exist in the actual game.

  • When setting Image or Texture properties, you must subtract 1 from the ID. You didn't.

  • Setting the Face of the object repeatedly is completely pointless. If you want it to appear on all faces, you must create multiple objects.

I would give you code, but it appears you still need to learn some of the basics of Lua. You can study on the wiki or with the video tutorials Roblox made.

0
I'd appreciate some code, but alright. I'll try to fix this. TheRings0fSaturn 28 — 10y
1
By the way, subtracting 1 from the ID doesn't always get you the ROBLOX Image asset. You occasionally have to subtract more, so you should always check on the website first.. adark 5487 — 10y
0
Thanks for that. Perci1 4988 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

THat script completely ruins the point of the script.

Answer this question