So I'm making a Minigame called ColourSink. But I'm having a little trouble with BodyPositioning.
I've tried Vectors, CFrames and even Tweens. Neither would fix my situation. Vectors would instantly go to it's place, leaving me to fall into the Lava, where I'd sink in. CFrames wouldn't work as the script has to randomly choose a colour slab, and all of the slabs are in different positions, whilst the CFrame will only hold one value. Tweening wouldn't work because the Positioning was stuffing up and/or hard to script.
But BodyPosition caught my eye. I was looking through the Toolbox, looking for that obstacle in obbies where the is the Start Brick, End Brick and the moving brick between them, I found out it had a bodyposition. So I thought I could do that with the slabs, as it would work, be beneficial, smooth and would be easy to script. I also had no other ideas to make this coloursink, and I wouldn't just give up as I have spent around 6 hours total coding the minigame.
But the bodyposition isn't doing what it's supposed to do.
It's supposed to be moving a random brick up as the lava goes up aswell. But it's just saying a colour, waiting 6 seconds, then saying another, over and over again.
Here is my scripting, tell me if something is wrong with it.
local chosen = {}
local function getSlab(slabs)
local n
repeat
n = math.random(1, #slabs)
until not chosen[n]
chosen[n] = true
return slabs[n]
end
function colourS()
slabs = game.Workspace.ColourSink.Slabs:GetChildren()
for i = 0, 6, 1 do
local slabChosen = getSlab(slabs)
game.Workspace.ColourSink.Billboard.Part.SurfaceGui.TextLabel.Text = slabChosen.Colour.Value
wait(2)
slabChosen.BodyPosition.position = slabChosen.endpart.Position
wait(4)
slabChosen.BodyPosition.position = slabChosen.startpart.Position
end
end

15 comments
Alright so it can also depend on the Part's Mass but why do you find tweening so hard for this, this seems like the perfect place for tweening
also i really think you should tostring() that slabChosen.Colour.Value unless its already a string
The tweening doesn't work since Position won't work. It gives me a Global Error(W001). Also what do you mean by string? Sorry, I forgot.
Like text string, in the sense at line 14 you set a TextLabel's Text to a slabChosen.Colour.Value if that Value's ClassName is Already a String you wont really have to worry about it but wrapping it in a tostring() would be cool beans
wait how are you using tweens, can you show me how you use tweens on part positions?
I'll try to clear out all the problems you have against tweens because this would be great for using TweenService, i'd do it client side but this seems fine
I watched the AlvinBlox tutorial and the partProperties table I did
local partProperties = {slabChosen.Position = slabChosen.Position + Vector3.new(0, 4, 0) } and I did the TweenService:Create and stuff.
wait a second what is endpart within the chosen slab, is it a separate part?
why does this seem unreasonably confusing, maybe because i dont really know how you made these, if you wish you can invite me to a TeamCreate but i'm going to be going off in a few minutes we can clear stuff up over there
the end part is where the tween stops at. then goes back down to start part, where it starts at. wait so do u want me to invite u to a team create now or not?
you can invite me now, i'll join when im free i just need to know how this is all set up since im somewhat confused
don't use body position if you have an anchored part , it will not work. Also, don't use the position property of an object either, as it takes into account collisions.
but it'll fall down if i dont anchor it?
I've unanchored it and changed the BodyPosition values as they were too I guess glitchy, it all works fine, but it tilts and rotates if I'm on one side of the platform. How do I make it so that doesn't happen.