Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how would i rotate this model as one instead of just one part being rotated?

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)

1 comment

0

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.

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.