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

Help anyone? (string expected, got boolean)

Asked by
LaysCo 61
3 years ago
Edited 3 years ago

when i walk onto a part material get the error (string expected, got boolean) and the mv.Value wont change thus breaking the rest of the script can i not change the stringvalue Value by touching a part material

script.Parent:WaitForChild("LeftFoot", "RightFoot").Touched:Connect(function(tuch)
    local mv = script.Material
    mv.Value = tuch.Material == Enum.Material --error occurs here

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

You must do Enum.Material.MaterialNameHere . When you type Enum.Material.it will try and finish your sentence by giving you a short list of Material Enums. View more about Enums here.

Edit

script.Parent:WaitForChild("LeftFoot", "RightFoot").Touched:Connect(function(tuch) -- tuch is the thing it touches.
    local mv = script:WaitForChild("Material") 
    mv.Value = tuch.Material -- tuch's material.
0
when i add Material.Air to the end i still get the same error LaysCo 61 — 3y
0
Air isn't a material. PrismaticFruits 842 — 3y
0
It has to be a material that you can use on parts. If you want to use material for terrain it will have to include Region3, which is quite hard. PrismaticFruits 842 — 3y
0
true its just a void space but even if i change the material the Value of the string value wont change LaysCo 61 — 3y
View all comments (5 more)
0
Oh I see. Let me edit my answer. PrismaticFruits 842 — 3y
0
I was confused at first sorry lol. PrismaticFruits 842 — 3y
0
its okay i didnt explain the problem well but when i changed code i just got another error (string expected, got EnumItem) LaysCo 61 — 3y
0
Maybe change tuch.Material to tuch.Material.Name ? PrismaticFruits 842 — 3y
0
yes it cleared up the error and everything is working now ty you so much been at that for 2 hours LaysCo 61 — 3y
Ad

Answer this question