Meteor Falling In A Random Postion In A Radius

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Need a model (meteor) to fall in a random spot, in a radius
  2. What is the issue? Include screenshots / videos if possible!
    getting the error:

TweenService:Create property named ‘Position’ cannot be tweened due to type mismatch (property is a ‘Vector3’, but given type is ‘double’) Line 22

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Dev Fourms and Youtube Videos.

Code:

local part = script.Parent
local part2 = script.Parent["Meshes/meteor_Icosphere_cell.004 (1)"]
local start = script.Parent.Parent.Start.Position

local Radius = 30

local destination = math.random(-Radius, Radius)

local floorTime = script.Parent.Parent.Parent.Parent.FloorTime

local debounce = false 

task.wait(3)

part.Position = start
part2.Position = start

if debounce == false then
	debounce = true

	local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
	local tween = game:GetService("TweenService"):Create(part, tweenInfo, {Position = destination})
	local tween2 = game:GetService("TweenService"):Create(part2, tweenInfo, {Position = destination})
	
	tween:Play()
	tween2:Play()
	
	tween2.Completed:Wait()
	script.Parent.Parent.ExplosionSound:Play()
	game.ReplicatedStorage.Remotes.Explosion:FireAllClients()
	
	script.Parent.Parent.Explosion.CFrame = script.Parent.Parent.End.CFrame
	wait(1)
	script.Parent.Parent.Explosion:Destroy()
	wait(0.5)
	script.Parent:Destroy()
	
end

Explorer:

image

1 Like

destination is a number, not a Vector3. Change the goals of the tween as such:

{Position = Vector3.new(destination,0,destination)} -- Edit the vector3 to your conveinience

Everything is working great now. A few more tweaks ands its done. Thanks alot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.