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

Invalid value "Type where the decal is going to face on the part" for enum Face?

Asked by 9 years ago

I'm making a plugin where you have to put in information of a decal to put in a part. Locating where the decal is is broken. People have to type the information.

local id = dId.Text
local selection = pselect.Text
local position = dpos.Text
local newdecal = Instance.new("Decal")
enter.MouseButton1Click:connect(function()
    newdecal.Texture = "" ..id
    newdecal.Parent = workspace:FindFirstChild( selection )
    newdecal.Face = "" ..position
end)

1 answer

Log in to vote
0
Answered by 9 years ago

position has the Text value "where the decal is going to face on the part". Perhaps "dpos" is referring to the wrong thing?

To improve your code, I'd recommend creating a function that converts "position" to an acceptable value (or at least use 'pcall' - then, if this error comes up because the user typed it in wrong, the script can just use a default face, or at least not cause an error).

Minor note: if 'position' is a string, there's no need to do "" .. position. If it might be 'nil', it'll error unless you do tostring(position), so there's no reason to prefer "" .. over tostring (to my knowledge).

Ad

Answer this question