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

Can you help me fix this problem with an if statement with a certain material?

Asked by 5 years ago

I'm trying to make an NPC that can walk through parts, but not parts that are Diamond Plate.

if game.Workspace.moof.seeed.Material == "DiamondPlate"
then
--I don't have to put the then part because It's not the problem.
0
Yeah should work... is seed supposed to have three es? TiredMelon 405 — 5y
0
Should work... Just check to make sure the names are correct, just in case. Ultimate_Miner64 45 — 5y

1 answer

Log in to vote
6
Answered by
amanda 1059 Moderation Voter
5 years ago

The issue is that the Material property is not a string, it is an Enum.

The reason this is hard to spot, is ROBLOX allows you to quickly assign Enum values with strings, however whenever checking them you cannot use this shortcut. if game.Workspace.moof.seeed.Material == Enum.Material.DiamondPlate then

0
^ What the..Who talks like that. Zafirua 1348 — 5y
Ad

Answer this question