Esythia
(Esythia)
February 21, 2020, 2:41pm
#1
Hello, I am making an obby, and one of the items is a moving lava block, I have tried to make one, using this script:
start = script.Parent.Parent.Start
finish = script.Parent.Parent.Finish
bodyposition = script.Parent.BodyPosition
while true do
bodyposition.Position = start.Position
wait(2)
bodyposition.Position = finish.Position
wait(2)
end
I get no errors in the output, I run the game, and it doesn’t move,
1 Like
blokav
(blokav)
February 21, 2020, 2:51pm
#2
There could be a few reasons for this.
The brick may still be anchored.
The bodyposition’s MaxForce may be too low.
The bodyposition’s P may be too low.
The brick may be connected to the floor or some other part that is anchored.
AdaptabiI
(Adaptabil)
February 21, 2020, 2:51pm
#3
Make sure your part is not anchored.
Canopius
(Canopius)
February 21, 2020, 2:51pm
#4
You should be using the Tween Service to move the block, not an unconditioned loop. There are 2 reasons for this, it will run smoother (thus look nicer) and use less server resources.
AdaptabiI
(Adaptabil)
February 21, 2020, 2:54pm
#5
The tween service can be very choppy sometimes so it’s best to either lerp the position or use bodypositions from my experience.
I have made an explosion effect with the use of meshes and tweenservice, it works as intended however, it’s a bit choppy and i can’t really find what’s wrong with it. The smoke doesn’t trail off as intended and it just kind of cuts to the smoke at a smaller size growing bigger again then dissapears:
Here’s my code if you can catch anything out:
local respos = script.Parent.PrimaryPart.Position
local respawntime = 2
local num = 0
local tweenservice = game:GetService("TweenService")
local tim…
While they do run smoother on the client, it’s still not guaranteed to always be smooth.
Esythia
(Esythia)
February 21, 2020, 2:55pm
#6
My part is not anchored, these are my properties:
The brick is un-collidable
AdaptabiI
(Adaptabil)
February 21, 2020, 2:56pm
#7
set the MaxForce to a massive number: 9999999999
see if it works then.
AdaptabiI
(Adaptabil)
February 21, 2020, 2:58pm
#9
Last thing to try is set the P to a big number, Re-adjust if the part is moving too quick.
Rezault
(Rez)
February 21, 2020, 2:58pm
#10
I would recommend using TweenService instead of a BodyPosition and setting the loop to true.
Esythia
(Esythia)
February 21, 2020, 3:01pm
#11
Set it to Inf, still doesn’t work… However, The part doesn’t fall, even though its not anchored…
Esythia
(Esythia)
February 21, 2020, 3:01pm
#12
I don’t understand how to make it move between two parts though.
AdaptabiI
(Adaptabil)
February 21, 2020, 3:03pm
#13
The problem seems to be with how you’re setting the bodyposition’s position then…
In your script try doing bodyposition.position = Vector3.new(start.position) etc
blokav
(blokav)
February 21, 2020, 3:04pm
#14
If ‘start’ and ‘finish’ are Parts then their positions are already Vector3s
AdaptabiI
(Adaptabil)
February 21, 2020, 3:05pm
#15
That’s true, my bad. I was thinking it could be a problem with indexing.
AdaptabiI
(Adaptabil)
February 21, 2020, 3:10pm
#16
The problem would only occur if you were using a locascript (network ownership problems) Otherwise it should work fine as it’s un-cancollide nothing is getting in the way.
I’d suggest moving to lerping or using a for loop.
Rezault
(Rez)
February 21, 2020, 3:11pm
#17
I’d recommend watching this video on TweenService.
AdaptabiI
(Adaptabil)
February 21, 2020, 3:12pm
#18
Reffering you to my previous post… Tweening can be very choppy sometimes.
The tween service can be very choppy sometimes so it’s best to either lerp the position or use bodypositions from my experience.
Choppy Tween, am i missing something?
While they do run smoother on the client, it’s still not guaranteed to always be smooth.
Rezault
(Rez)
February 21, 2020, 3:14pm
#19
Assuming you’re not using it in a loop, TweenService works really well for just moving a part from one place to another. I’ve used it many times and it was really smooth.
AdaptabiI
(Adaptabil)
February 21, 2020, 3:17pm
#20
It depends, on the task at hand, and personally I’ve had very choppy results from tweening in the past (especially prominent when there was alot of tweens going on at once)
As soon as I switched to lerp, the animations ran smoother and there still wasn’t a massive drop in performance.