Hey there! So recently I’ve been developing a game of sorts and want to implement a feature which will spawn flying MeshParts that will jump around the map, kinda like this:
It would be helpful to know of the current code you’ve made if it relates to what you’re trying to create currently.
From what I can see right now, alot of what you’re asking for in the gif is mainly just an instance.new("MeshPart") and instance.new(BodyForce)
Sorry if this doesn’t help, its alittle confusing about what part you’re asking to help with.
Heres the API page for instance API - Instance
Hey, thanks for the reply! Here’s my current code as of right now:
local e = 1
local initialposition = script.Parent.Position
local initialorientation = script.Parent.Orientation
wait(5)
repeat
wait(1)
script.Parent.Position = initialposition
script.Parent.Orientation = initialorientation
until e == 2
Sorry for the confusion. To specify, I wanted the MeshParts to jump around in the air like the teapots do in the gif. I just can’t seem to figure out how to do so. I’ve tried changing the velocity of the MeshPart in Properties, but I didn’t seem to notice a change in the MeshPart’s movement as I intended to.
what you need to do is duplicate the teapots from replicated storage and send them in the direction you wish. give me a moment to write out an example script.
Put this script into the part that spawns the parts. Also, put the meshpart you wish to spawn in ReplicatedStorage.
while wait(5) do --put how often you want the part to spawn a meshpart
local pot = game.ReplicatedStorage.Teapot:Clone() --replace Teapot with the parts name
pot.Parent = game.Workspace
pot.Position = script.Parent.Position
pot.Velocity = Vector3.new(0, 0, 0)--put the speed you want the parts to travel
end
Also, put this script in the part(while it is in replicated storage)
script.Parent.AncestoryChanged:Connect(function()
wait(10)--put how long you want it to last after spawned
script.Parent:Destroy()
end)
Thanks, just the answer I was looking for! Although, I did seem to notice one crucial typo that kinda broke the despawn system. You spelled AncestryChange as AncestoryChanged. Sometimes I wish Lua had some common sense. Besides that, everything works amazing! Thank you so much!