invalid argument #1 to 'rad' (number expected, got CFrame)?
Hello, I am having an error with this block of code:
1 | function game.ReplicatedStorage.Build.OnServerInvoke(Player, Pos, ItemName, counter) |
2 | local Item = game.ReplicatedStorage.Ores:FindFirstChild(ItemName):Clone() |
3 | Item.PrimaryPart.CFrame = CFrame.new(Item.PrimaryPart.Position) * CFrame.Angles( 0 ,math.rad(counter), 0 ) |
4 | return PlaceItem(Player, Pos, Item, counter) |
Basically, this is the server side to a rotation script (whenever you press r a model rotates by 45 degrees). Each model does a have primarypart. So everytime you press r, in the localscript, it increases a value by 45 (counter variable). You can see that I brought over the counter variable on the server invoke. So I tried putting the counter variable into a CFrame.Angles setup, and got the error. I don't know why this is happening as counter is saved as a number variable. Maybe the transition from local to server screwed it up? Any help would be appreciated.