Hey, I was wondering how I'd make it so once a player touches a part the player moves ina position using c frame (e.g. facing forward), how would I do this? :)
COMMUNITY QUESTION
How do I cframe a player in position when they touch a part?
1 answer
CFrame can be used to rotate as well as move an object. You can try something like this:
local Part = workspace.Part
local Players = game:GetService('Players')
Part.Touched:Connect(function(otherPart)
local Player = Players:GetPlayerFromCharacter(otherPart.Parent) -- use service to get player
if Player then -- check if player
local Character = Player.Character or Player.CharacterAdded:Wait() -- get character
Character.HumanoidRootPart = CFrame = Character.HumanoidRootPart.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
end
end)
Use the math.rad() to rotate the player accordingly, while still keeping the Player's position.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You would need to change the player's HumanoidRootPart's CFrame based on its CFrame.LookVector