game:GetService("Players").PlayerAdded:Connect(function(player)
local flying = Instance.new("BoolValue",player)
flying.Name = "flying"
flying.Value = false
end)
local event = game:GetService("ReplicatedStorage"):WaitForChild("fly_broom")
local work = game:GetService("Workspace")
event.OnServerEvent:Connect(function(player,command)
if player.flying.Value == false then return end
local bodyforce
local sit
for i,v in pairs(work:GetChildren()) do
if v.Name:split("'")[1] == player.Name and not v:FindFirstChild("Humanoid") then
if v.sit:FindFirstChild("BodyPosition") then
bodyforce = v.sit.BodyPosition
sit = v.sit
end
end
end
if command == "W" then
bodyforce.Parent.flying.Disabled = false
elseif command == "Ended" then
if not bodyforce then return end
bodyforce.Parent.flying.Disabled = true
elseif command == "space" then
for i,v in pairs(bodyforce.Parent.Parent:GetChildren()) do
v.CanCollide = true
local turned = false
end
local model = sit.Parent
sit.Touched:Connect(function()
sit.Anchored = true
sit.Orientation = Vector3.new(0, 0, -32.83)
--ive tried with model:SetPrimaryPartCFrame(CFrame.Angles(numbers)) but this only put my model somewhere completely else so idk how to rotate
end)
bodyforce:Destroy()
player.Character.HumanoidRootPart.WeldConstraint:Destroy()
wait(3)
player.flying.Value = false
end
end)
COMMUNITY QUESTION
how would i rotate this model as one instead of just one part being rotated?
1 answer
Assign a PrimaryPart to the model (property of model) and use the :SetPrimaryPartCFrame() method.
https://developer.roblox.com/en-us/api-reference/function/Model/SetPrimaryPartCFrame
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
try using :SetPrimaryPartCFrame() but instead of setting a new CFrame, add on to the current CFrame. that should fix it moving to a whole different position.