How can i make the Humanoids Stick to The Platform

So Im Making a Script That Moves The Platform, Only Problem Is, Is That Humanoids Are Not Sticking On The Platform

this is the Script


moveDelay = 10

hideDestinationBlocks = true

local TweenService = game:GetService("TweenService")

local mainFolder = script.Parent


local destinationList = {}

for index, value in pairs(mainFolder:GetChildren()) do
	local valueName = value.Name
	if string.match(valueName, "Destination ") then
		table.insert(destinationList, valueName)
	end
end

local sortedList = {}
repeat
	local lowestValue = {nil, math.huge}

	for index, value in pairs(destinationList) do
		local nameSplit = string.split(destinationList[index], " ") 
		local stringToNumber = tonumber(nameSplit[2]) 
		if stringToNumber < lowestValue[2] then
			lowestValue = {index, stringToNumber}
		end
	end
	table.insert(sortedList, destinationList[lowestValue[1]])
	destinationList[lowestValue[1]] = "Destination 123456"
until #sortedList == #destinationList 

if hideDestinationBlocks == true then
	for index, value in pairs(sortedList) do
		local destinationBlock = mainFolder:FindFirstChild(sortedList[index]) 
		destinationBlock:ClearAllChildren()
		destinationBlock.Transparency = 1
	end
end


while true do 
	for index, value in pairs(sortedList) do
		local destinationBlock = mainFolder:FindFirstChild(sortedList[index])
		TweenService:Create(script.Parent.Platform,TweenInfo.new(moveDelay,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Position = Vector3.new(destinationBlock.Position.X,destinationBlock.Position.Y,destinationBlock.Position.Z)}):Play()
		
		wait(moveDelay)
	end
end
1 Like

If you are using CFrames then you can use the Jailbreak CFrame raycast train technique of raycasting and a lot of other stuff.

@StrongBigeMan9 made an excellent post about it, with problems and solutions in detail plus a place file.

2 Likes

Hi can u explain what 8 th line mean I’m a beginner guy in roblox scripting

Ironically enough it’s you who also has a dumb response!!! He was not referring to what you are explaining :scream:. Instead he was referring to the 8th line of the code in the OP. Furthermore, it’s a bit ignorant to assume someone is 10 just because of that?

1 Like

My bad, i didn’t fully read the reply.

This just means that if the value has the word “Destination” in it then it will execute the code after

thank you so much man this really help me out