Possibility 1: Using lookVectors
My first suggestion is to use lookVectors to push the player along the face they are standing on.
local player = game.Players.LocalPlayer
local part = workspace.Part
part.Touched:Connect(function()
player.Character:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame + (part.CFrame.LookVector * Vector3.new(0.05, 0, 0)))
end)
while true do
part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(.002,.005,.009)
wait(.001)
end
Possibility 2: Using Welds
My second thought is to try Welds, which will guarantee the player is moving with the part's rotation, but must be broken / removed by another function (as the player wlll be unable to move)
local player = game.Players.LocalPlayer
local part = workspace.Part
part.Touched:Connect(function()
local weld = Instance.new("Weld", player.Character.HumanoidRootPart)
weld.Part0 = player.Character.HumanoidRootPart
weld.Part1 = part
weld.C0 = CFrame.new(0, -5, 0)
end)
while true do
part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(.002,.005,.009)
wait(.001)
end
I'll be happy to answer any questions or concerns regarding these methods.
EDIT: Comment, to call the player in the server, you need to activate a touch-based detectable event (usu. w/ ClickDetectors or .Touched)
Server Variant of lookVector
local part = script.Parent
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local character = hit.Parent
character:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame + (part.CFrame.LookVector * Vector3.new(0.05, 0, 0)))
end
end)
while true do
part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(.002,.005,.009)
wait(.001)
end
However, since this doesn't work as smoothly as the Local Variant I suggest using the first code listed above instead (placed in a LocalScript under StarterGui)
2 comments
just edited my answer to include making the part float
I added a comment, and adjusted the scripts accordingly, it will index the player correctly now, though make sure that the script / localscript is in the correct parent (workspace / serverscriptservice or startergui)