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