How to change a float to int

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Coder8188

I have been trying to create a random generation but I need a random number and when I set the position it says that:
Invalid set index ‘x’ (on base: ‘CSGMesh’) with value of type ‘float’.
Here is my code:

extends Spatial
var rand_generate =
onready var land = $CSGMesh
func _ready():
# randomize seed
# generate a random float between -1 and 0
var rand_float = floor(rand_generate.randf_range(0, 100) * 10)
# print random number
land.x = rand_float

:bust_in_silhouette: Reply From: Magso

With land.x you’re trying to set the position as though the CSGMesh is a Vector3. You need to set the land.translation.x or land.transform.origin.x, regardless if it’s a float or int.