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

I just got a (Vector3 expected, got number) error. How do I fix it?

Asked by
zyrun 168
7 years ago

I'm just trying to create a part from a different part. I'm not sure what the problem is. Here is my script

1--A Script in ServerScriptService
2local WallThickness = 4
3local WallHeight = 50
4local Part = game.Workspace.Part
5local CreatedPart = game.Workspace.Part:Clone()
6 
7CreatedPart.Size = Vector3.new(WallThickness, WallHeight, Part.Size.Z)
8--Error on the line below this one
9CreatedPart.CFrame = CFrame.new(Part.Position.X - ((Part.Size/2) + WallThickness), (CreatedPart.Size/2 + Part.Position.Y), Part.Position.Z)
0
Could you paste the output line in the comments so we can help you further? EnderGamer358 79 — 7y
0
Sorry,just read this. Here it is: 19:34:18.039 - ServerScriptService.MasterScript.CompiledScripts:494: bad argument #2 to '?' (Vector3 expected, got number) zyrun 168 — 7y

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
7 years ago
Edited 7 years ago

your value named WallThickness is a single number. You're adding it to Size on the line with an error. Size is a Vector3 value, and WallThickess is a single number value. Therefore, they cannot be added together. Maybe use (Part.Size.X/2) + WallThickness instead?

0
Thanks. I meant to add the ".X" in the first place, but I guess I messed up. zyrun 168 — 7y
Ad

Answer this question